control quiz
SJSU EE30 F15 Quiz 1
First:________________ Last:________________ Last 4 id:_____
Self evaluation (H/M/L): #1 #2 #3
What will the following segment of code output?
int score = 40;
if (score > 95)
cout << "Congratulations!\n";
cout << "That's a high score!";
cout << "This is a test!" << endl;
That's a high score!This is a test!
What is the output of the following segment of code?
int num = 4;
int total = 50;
if ((num < 5) || ( total > 50))
cout << total << endl;
else cout << num << endl;
50
Write a complete and minimum program that prints 2 digit even numbers from large to small. Print a star * right after the number if the number is also a multiple of 5.
for ( int i=98; i>=10; i=i-2) {
cout << i;
if ( i %5 ==0) cout << “*”;
cout << “,” ; // just to separate numbers
}
There are many ways to do this, of course.