Kingdom of Saudi Arabia Magmaa University College of Science, Alzulfi Principles of algorithms and computer programming المملكة العربية السعودية جامعة المجمعه كلية العلوم بالزلفي مبادىء الخوارزميات وبرمجة الحاسبات :االسم Q1) What is the output of the following program segments: Program segment output int x=7, y=2,z=3; cout<< "X = " << ++x << "\t Y= " << y++ << endl; z+=y; cout<< " now X = " << --x << "z= " << z << endl; for(j = 4; j<=16; j*=2) cout << j << endl; x=1; if(x<1) x=x+5; else if(x>1) x=x-5; else x=5; cout<<”x=”<<x; j = 4; while ( j <= 16 ) { j = 2 * j; cout << j << endl; } for (k = 10; k <= 16; k++) if (k%2!=0) cout<<k<<endl; Q2) suppose a, b and c are integer variables that have been assigned the values a = 8, b = 3 and c =5. Determine the value of each of the following arithmetic expressions. a. Static _ cast <double> (a+c) b. c. b/2 + 3 * ( a - c ) Static _ cast <int> (b) Q3) Write a program in C++ that determines a student is succeed or not in a subject where the degree of succeed is 60. Q4) Write a complete C++ program to ask a user to enters numbers between 20 and 60. Print the even numbers. 1