Home » C Programming » Expressions

What will be the output of the program? #include int main() { int a=100, b=200, c; c = (a == 100 || b > 200); printf("c=%d\n", c); return 0; }

Correct Answer: c=1

Explanation:

Step 1: int a=100, b=200, c;
Step 2: c = (a == 100 || b > 200);
becomes c = (100 == 100 || 200 > 200);
becomes c = (TRUE || FALSE);
becomes c = (TRUE);(ie. c = 1)
Step 3: printf("c=%d\n", c); It prints the value of variable i=1
Hence the output of the program is '1'(one).

← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion