19. WRITE A C PROGRAM FIND LARGEST AMONG 3 VARIABLES USING NESTED IF

/* Find largest among 3 variables using nested if */

#include <stdio.h>
#include<conio.h>
int main()
{
int a,b,c;
printf("Enter 3 numbers: \n");
scanf("%d %d %d",&a,&b,&c);
if(a>=b)
{
if(a>=c)
printf("%d is largest",a);
else
printf("%d is largest",c);
}
else if(b>=c)
printf("%d is largest",b);
else
printf("%d is largest",c);
return 0; 
}

output

enter three numbers
10
20
30
30 is largest

Comments