I am curious to know as why this statement would print "true"?

Joined
Jan 9, 2021
Messages
1
Reaction score
0
Let's do that calculation part by part,
Due to maths operator precedence, we need to dive into deepest brackets, and after that, we have to calculate step by step
(18 == 2 * (18 / 10 + 18 % 10))
For (18 / 10 + 18 % 10)
18 / 10 -> 1
18 % 10 -> 8, Because it divides 18 by 10, the remainder is 8
8 + 1 = 9
After calculations: 18 == 2 * 9
2 * 9 -> 18
18 == 18 // true
So, that's very normal to be true
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top