Ask Question
9 May, 11:19

What will the following segment of code output?

Assume the user enters a grade of 90 from the keyboard.

cout << "Enter a test score: ";

cin >> test_score;

if (test_score < 60);

cout << "You failed the test!" << endl;

if (test_score > 60)

cout << "You passed the test!" << endl;

else

cout << "You need to study for the next test!";

+2
Answers (1)
  1. 9 May, 11:58
    0
    "You passed the test!"

    Explanation:

    Here user reading grade "test_score" and checking the student score in "If" condition. If it is less than 60 we are printing "You failed the test!" and if it is >60 we are outputting the string "You passed the test!" and else if it not satisfying any of these then we are printing "You need to study for the next test!". As "test_score" value is 90 which is >60 it satisfies the condition >60. So we are printing the string "You passed the test!"
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What will the following segment of code output? Assume the user enters a grade of 90 from the keyboard. cout > test_score; if (test_score < ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers