After execution of the following code what is the value of t

After execution of the following code, what is the value of the int variable N if the user inputs the value 5? (The following code may have been indented incorrectly) cin > greaterthan N; if(N > 10) N = N + 5; else N = N + 10; 25 None of the answers provided 0 10 5 15

Solution

For value of N = 5; the answer of above code is 15. Therefore, last option (15) is correct.

Explanation:

Since N is not greater than 10 therefore else part will get exected; resulting in (5+10)=15.

 After execution of the following code, what is the value of the int variable N if the user inputs the value 5? (The following code may have been indented incor

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site