C Programs - Conditional


In C language, statements are executed sequentially.

But sometimes we want to execute some part of our code conditionally or we need to make decision based on some condition.

In C language following types of conditional statements can be used:

  1. if statement
  2. if-else statement
  3. if-else ladder
  4. Nested if-else statement
  5. switch statement

In this section, we will try programs based on conditional statements mentioned above.

List of programs

  1. C program to check if number is even or odd
  2. C Program to find maximum between two numbers
  3. C Program to find maximum between three numbers
  4. C Program to check if number is positive, negative or zero