Ask Question
12 December, 13:54

What will be the value of input_value if the value 5 is input at run time?

cin >> input_value;

if (input_value > 5)

input_value = input_value + 5;

else if (input_value > 2)

input_value = input_value + 10;

else

input_value = input_value + 15;

+3
Answers (1)
  1. 12 December, 16:14
    0
    15

    Explanation:

    The if else state is used for checking the condition and if the condition is TRUE and program can execute the statement within the if else.

    Initially input_value is 5

    then the if statement check the condition 5>5, condition FALSE because 5==5

    it not less than 5.

    then program move to else if and check condition 5>2, condition TRUE.

    then, input_value = 5 + 10=15 execute and update the value to 15.

    After that, program terminate the if else statement.

    Therefore, the answer is 15.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “What will be the value of input_value if the value 5 is input at run time? cin >> input_value; if (input_value > 5) input_value = ...” 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