# Conditional Statement

### Conditional Statement

Sometimes, we need to perform different actions based on different conditions. It can be perform with the help of Relational operator or conditional statement.

### Conditional Operator

 > greater thanExample:- a=4 and b= 2; a>b a is greater than b < less thanExample:- a=2 and b=4; a a is less than b. >= greater than or equal to <= less than or equal to == equals toExample: a=2 and b=2;a==b a is equals to b != is not equals toExample: a=2 and b=4; a!=b a is not equals to b

### Relational Operator

 && AND if both condition true than statement will be execute. || OR any one condition true than statement will be execute ! NOT NOT.

### Conditional Or Branch Statements

• Simple if (Single selection)
• if else (two way selection)
• nested if (if inside a if)
• else if ladder (Multi way selection)
• switch (multi way selection)

### The if Statement(One way selection/decision)

An if statement is a single selection or decision statement.it used when we have only one alternative .

Syntax:-
If(expression)
{
statement 1
statement 2
.
.
statement n
}
the statements are executed if the condition is true.

### W.A.P to print the largest no:-

`#include<stdio.h>#include<conio.h>void main() {    int a,b,big;    printf("Enter two numbers\n");    scanf("%d%d",&a,&b);     big=a;   if(b>big)       {                      big=b;                }      printf("largest number=%d",big);    getch();  } `

### Output

Enter two numbers
3  4
largest number=4