Ask Question
19 February, 21:50

Consider the following statements. If the input is 95, the output of the following code will be: #include #include using namespace std; int main () { float score; string grade; cin >> score; grade = "Unknown"; if (score > = 90) grade = "A"; if (score > = 80) grade = "B"; if (score > = 70) grade = "C"; else grade = "F"; cout << grade; }

+5
Answers (1)
  1. 19 February, 21:57
    0
    The output will be "C"; without the quotes

    Explanation:

    Given

    The program above

    Required

    What will be the output if user input is 95

    The output will be 95;

    Analysis

    1. Initially, grade = "Unknown"

    grade = "Unknown";

    2. Because user input is greater than 90, grade changes its value from "Unknown" to: grade = "A"

    if (score > = 90)

    grade = "A";

    2. Because user input is greater than 80, grade changes its value from "A" to: grade = "B"

    if (score > = 80)

    grade = "B";

    3. Because user input is greater than 70, grade changes its value from "B" to: grade = "C"

    if (score > = 70)

    grade = "C";

    4. This will not be executed because it specifies that if user input is less than 70; Since, this statement is false; the value of grade is still "C"

    else grade = "F";

    5. The value of grade is printed

    cout << grade;
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Consider the following statements. If the input is 95, the output of the following code will be: #include #include using namespace std; int ...” 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