C Programming · Question 16 · Easy

What will be the output of the following C program?

#include <stdio.h>

int main(void) {
    printf("%d", 10 > 5 > 2);
    return 0;
}
  1. 1
  2. 0
  3. Compilation error
  4. 2
Answer and explanation

Answer: B. 0

Explanation: Relational operators group left to right, so it is (10 > 5) > 2. 10 > 5 gives 1, and 1 > 2 gives 0.

Previous: What will be the output of the following C program? · Next: What will be the output of the following C program?

Practise c programming

Try a fresh set of c programming questions with an explanation after every answer, free and without signing up: C Programming practice. Or sit a full placement mock test.

More c programming questions

More technical & programming practice

Java · Python · Data Structures · Algorithms · Object-Oriented Programming · DBMS · SQL · Operating Systems

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge