What will be output by each of the following program segment
What will be output by each of the following program segments in C- and/or C++? (i) double a =15; double b = 15; cout
Solution
Question 1:
Answer:
0
3.75
first cout will print 0 value and second cout will print 3.75 value.
3/4*b it means first 3/4 will execute as per precedence. it will return 0. 0 * b = 0.
Question 2:
Answer:
0
2
a value is 0 and b value is 2 here
Question 3:
Answer: 5 7
a value is 5 and b value is 7
