find the largest among three numbers

10. Write a program find the largest among three numbers?
#include

#include
void main()
{
int a,b,c;
clrscr();
printf(" enter three nos.");
scanf("%d%d%d",&a,&b,&c);
if((a>b)&&(a>c)
printf("large%d",a);
else
if((b>c)&&(b>c))
printf("large%d",b);
else
printf("large%d',c);
getch();
}


Algorithum
1.start
2.read a,b,c
3.if (a>b)&(a>c)
4.print large is a
5.else
6.if (b>c)&(b>a)
7.print large is b
6.else
7.print large is c
8.stop


Result
The program is sucessfully executed and desired is obtained

Output
enter three numbers
1 3 5
large 5


0 comments:

Post a Comment