What will be the output of the following code : [CBSE Text Book]
a = 3 – 4 + 10 b = 5 * 6 c = 7.0/8.0
Answers
Answer:
answer is = 6.525
Explanation:
I hope u understand ..
if I did any mistakes I'm sorry...
Output purely depends on the data type of the variable
Explanation:
Assuming that this is to understand various operation.
All the operations will be carried out based on the BODMAS rule.
Since all the given operations are arithmetic, the precedence will get followed from "left to right"
Precedence and priority:
eg. + and - has the same power so which ever comes first will get executed first
/ and * has the same power. Hence same as above. But it has priority than + and -
a= 3-4 + 10
Ans: 3-4 = -1 => -1 + 10 = 9
b = 5*6 = 30
c = 7.0/8.0 =>0.875
Suppose if C is declared as integer, then the decimal value will be truncated and output will be zero.
To Know More:
https://brainly.in/question/1678742
What is BODMAS rule?
https://brainly.in/question/4720364
Write a C++ program to demonstrate the use of operator precedence