An if statement is a single selection or decision statement. It is used when we have only one alternative.
Q.) W.A.P to print the biggest number using simple if statement.
#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