
PRO
Soumyadeep
asked

Expert
Kelish Rai answered
In C, when you use a comparison like total > 100, it doesnât return true or false as words â it returns a number:
1if the condition is true0if itâs false
So if you write:
result = total > 100;
C checks if total is greater than 100. If it is, result becomes 1. If not, result becomes 0.
Thatâs why the output is either 0 or 1 â it's just how C handles boolean logic under the hood.
If you have more questions, I am here to help.
C
This question was asked as part of the Learn C Programming course.
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer
