Ask Question
21 October, 18:46

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. 21 October, 21:12
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers