Ask Question

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!";

+3
Answers (1)
  1. 14 February, 23:20
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers