What value will be stored in result by the assignment statem

What value will be stored in result by the assignment statement shown? result = 8 - 4 * 2 + 9 - 13/2; A) none of these B) 3 C) 3.5 D) 2 E) 2.5 Which of the following function invocations is an approximation of PI

Solution

In c++ ,unless until specified the values are taken as integers.thus the output will be 3.

If you explicitly define flaot a=13,b=2 and float result,we get 2.5.

If result is declared float also,the calculation at end stores 3 into result.

Ans:B

 What value will be stored in result by the assignment statement shown? result = 8 - 4 * 2 + 9 - 13/2; A) none of these B) 3 C) 3.5 D) 2 E) 2.5 Which of the fol

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site