# Program for largest and second largest of three numbers

0
57
```#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter three numbers\n);
scanf("%d%d%d",&a,&b,&c);
if((a<b)&&(a>c))   /* checking for a is largest */
{
printf("\n largest =%d",a);
if(b>c)       /* when a is largest either b or c is second largest */
printf("\n second largest = %d",b);
else
printf("\n second largest = %d",c);
}
else
if((b>a)&&(b>c))    /*  checking for b is largest  */
{
printf("\n largest=%d',b);
if(a>c)     /*  when b is largest either a or c is second largest */
printf(\n second largest =%d",a);
else
printf("\n second largest =%d", c);
}
else   /* when a or b is not largest then c will be largest */
{
printf("\n largest =%d",c);
if(a>b)   /* when c is largest either a or b is second largest */
printf("\n second largest = %d",a);
else
printf("\n second largest = %d",b);
}
getch();
}
Output 1:
Enter three numbers
4 6 8
largest=8
second largest=6
Output 2:
Enter three numbers
9 5 9
largest=9
second largest=9
Output 3:
Enter three numbers
3 3 3
largest=3
second largest=3

```

Program for largest and second largest of three numbersÂ c program to find largest and second largest of three numbers program to find largest and second largest of three numbers in cÂ Program to largest and second largest of three numbersÂ largest and second largest of three numbersÂ