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:
- if statement
- if-else statement
- if-else ladder
- Nested if-else statement
- switch statement
- Conditional / Ternary operator
In this section, we will try programs based on conditional statements mentioned above.
List of programs: if-else
- C program to check if number is even or odd
- C Program to find maximum between two numbers
- C Program to find maximum between three numbers
- C Program to check if number is positive, negative or zero
- C program to check if a year is leap year or not
- C program to check if a character is alphabet or not
- C program to check if a given alphabet is vowel or consonant
- C program to check if a given character is an alphabet, digit, or special character
- C program to check if a character is uppercase or lowercase alphabet
- C program to input angles of a triangle and check whether triangle is valid or not
- C program to input all sides of a triangle and check if triangle is valid or not
- C program to check if the triangle is equilateral, isosceles or scalene triangle
- C program to find all roots of a quadratic equation
- C program to calculate profit or loss