Expressions - Programming

Q1:

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

A c=100

B c=200

C c=1

D c=300

ANS:A - c=100

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).