WAP to find the greatest of three number.
#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("a is largest");
else
printf("c is largest");}
else
if(b>c)
printf("b is largest");
else
printf("c is largest");
getch();
}
Output
Enter the value of a:34
Enter the value of b:334
Enter the value of c:76
B is largest
No comments:
Post a Comment