Maximum of three Number (nested if-else)

Monday, 29 August 2011

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter the value of a");
scanf("%d",&a);
printf("\nEnter the value of b");
scanf("%d",&b);
printf("\nEnter the value of c");
scanf("%d",&c);
if(a>b)
 {
   if(a>c)
   {
   printf("\na is greater");
   }
   else
   {
   printf("\nc is greater");
   }
}
else
{
   if(b>c)
   {
   printf("\nb is greater");
   }
   else
   {
   printf("\nc is greater");
   }
}
getch();
}

OUTPUT:

Enter the value of a 5
Enter the value of b 8
Enter the value of c 3
b is greater




No comments:

Post a Comment

 

Blogger news

Blogroll

Enter your email address:

Delivered by FeedBurner

Total Pageviews

Followers

Most Reading