Find Largest Number using Nested If Statement

Last Updated on

/* WAP to find the largest of three numbers using nested if. */

#include<stdio.h>
main()
{
int a,b,c,big;
clrscr();
printf(“Enter three numbers”);
scanf(“%d%d%d”,&a,&b,&c);
if(a>b)
if(a>c)
big=a;
else
big=c;
else
if(b>c)
big=b;
else
big=c;
printf(“Largest of %d,%d and %d=%d”,a,b,c,big);
getch();
}

OUTPUT
Enter three numbers 10 5 16
Largest of 10,5 and 16=16

resume

Mohit Arora
Follow me