For (int I = 1; I <= 5; i++) { cout << I << " "; }
1 2 3 4 5 6
1 2 3 4 5
0 1 2 3 4 5
1 2 3 4
int num = 4;
if (num % 2 == 0) { cout << num << " is even."; }
else { cout << num << " is odd."; }
4 is odd.
4
4 is even.
Is even
for (int I = 1; I <= 3; i++)
{
         if (i % 3 == 0) {
          cout << I << " is divisible by 3" << endl;
         }
}
3 is divisible by 3
....
2 is divisible by 3
1 is divisible by 3
int x = 10;
if (x > 15) {
       cout << "Greater";
} else {
         cout << "Smaller";
}
Greater
Error
Smaller
No output
int score = 75;
if (score > 90) {
cout << "Excellent";
} else if (score > 80) {
cout << "Very Good";
} else if (score > 70) {
cout << "Good";
} else { cout << "Average"; }
Excellent
Very Good
Average
Good
bool flag = false;
if (!flag) {
cout << "Flag is false";
} else {
cout << "Flag is true";
}
Flag is false
Flag is true
Error
No output
{"name":"for (int i = 1; i <= 5; i++) { cout << i << \" \"; }", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"for (int i = 1; i <= 5; i++) { cout << i << \" \"; }, int num = 4; if (num % 2 == 0) { cout << num << \" is even.\"; } else { cout << num << \" is odd.\"; }, for (int i = 1; i <= 3; i++) {          if (i % 3 == 0) {           cout << i << \" is divisible by 3\" << endl;          } }","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}
Make your own Survey
- it's free to start.