Conditional statements in C Introduction
Conditional statements in C are used to make decisions.
They allow a program to execute different blocks of code based on whether a condition is true or false.
Why Conditional Statements Are Needed
- To compare values
- To take decisions in programs
- To control the flow of execution
- To perform different actions for different conditions
Types of Conditional Statements in C
C provides the following conditional (decision-making) statements:
ifstatementif–elsestatementelse–ifladder- Nested
if switchstatement
