Ask 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 = input_value + 5;

else if (input_value > 2)

input_value = input_value + 10;

else

input_value = input_value + 15;

+2
Answers (1)
  1. 27 June, 14:53
    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 & 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