Electronics and Communication Engineering - Microprocessors - Discussion

Discussion Forum : Microprocessors - Section 3 (Q.No. 16)
16.
Assuming that k is an integer what would the result of following expression in C
k = 2* 3 / 5 + 4 / 4 + 8 - 2 - 4 / 8
8
7
7.5
zero
Answer: Option
Explanation:

k = 1 + 1 + 8 - 2 - 0 = 8 because k is an integer.

Discussion:
5 comments Page 1 of 1.

Paras said:   6 years ago
BODMAS rule:

1. Brackets.
2. Orders.
3. Division AND multiplication (left to right).
4. Addition AND subtraction (left to right).

Kanchana said:   6 years ago
Yes.

Bodmas rule was applied.

2*3/5 ==> 6/5 = 1.2 = 1.
4/4==> 1.
+8
-2
4/8==> 0.5 = 0.

In the 1st step, 1.2 is treated as '1'.
And the last step 0.5treated as '0'.

Because k is an integer.
(1)

Arthi said:   7 years ago
How 4/8=0?

Akash said:   7 years ago
Why answer is 8? I don't understand.

Ravi Garg said:   9 years ago
Is Bodmas formula applied or not?

4/8 = 0?

Post your comments here:

Your comments will be displayed after verification.