After execution of the following code, what will be the value of input_value if the value 0 is entered at the keyboard 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;

Respuesta :

tanoli

Answer:

15

Explanation:

Once user input 0 for input value, the next statement is to check whether input value is greater then 5 by using first if. First if body will not execute as it is a false statement.

Next else if will check the input value is greater then 2 and again this else if body will not execute as input value is 0.

So the only part of this program which will execute is else. In If else, if the all conditions are false then the else part will execute.

So in else part we are adding 15 into the input value which is 0. so the result after executing the code will be 15.

ACCESS MORE
EDU ACCESS