What is grade in the following program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is grade in the following program?

#include <iostream> using namespace std; int main() { int age = 20; int grade = 80; if (age > 16 && age < 60 && grade > 50) { cout << "Accepted!" << endl; } return 0; }

22nd Nov 2016, 8:26 AM
neil
neil - avatar
1 Answer
+ 3
How I see it, grade is 80 and it is more than 50 in your condition so it pass. Age is 20 and it is more than 16 and less than 60. In your if statement all tree conditions need to be true and in your case they are.... so it will write out Accepted!...
22nd Nov 2016, 8:43 AM
Dusan Veljkovic
Dusan Veljkovic - avatar