C Program to find minimum between two numbers using if-else statement
Here is the C program in which we have to find the minimum number between two numbers using if-else statement.
#include<stdio.h>
#include<conio.h>
void main()
{ int a,b;
clrscr();
printf(“Enter two numbers:”);
scanf(“%d%d”,&a,&b);
if(a<b)
{ printf(“%d is minimum”,a);
}
else
{ printf(“%d is minimum”,b);
}
getch();
}
Output
The general syntax of if-else statement is :
if (condition)
{ true statement ;
}
else
{ false statement;
}
statement x;
- In if-else statement first condition is checked.
- If the condition is true then the true statement will be executed and the statement x will be executed.
- If the condition is false then it will execute the false statement block and then statement x.