Demonstration of nested if-else
Program to find bigger number
#include<stdio.h>
#include<conio.h>
void main ()
{
int n1=0,n2=0,n3=0;
clrscr();
printf("\n\t enter 3 no to compare :");
scanf("%d %d %d",&n1,&n2,&n3);
if(n1>n2 && n1>n3)
{
printf("\n\t the greatest no is %d",n1);
}
else
{
if(n2>n1&& n2>n3)
{
printf("\n\t greatest no is %d",n2);
}
else
{
if(n3>n1&& n3>n2)
{
printf("/\n\t the greatest no is %d ",n3);
}
else
{
printf("\n\t all no are equal :");
}
}
}
getch();
}
OUTPUT :
0 comments:
Post a Comment