C Program to find the greatest of three numbers using nested If Statements.

 


#include<stdio.h>

#include<conio.h>

main()

{

int a,b,c,big;clrscr();

printf("\nEnter three Numbers\n");

scanf("%d%d%d",&a,&b,&c);

if(b>c)

big=b;

else

big=c;

if(a>b)

{

if(a>c)

big=a;

else

big=c;

}

else

printf("\nThe greatest of three numbers is %d",big);

getch();

}



Output:

  1. Enter three Numbers

12

34

10


The greatest of three numbers is 34


  1. Enter three Numbers

45

56

78


The greatest of three numbers is 78


  1. Enter three Numbers

30

20

10


The greatest of three numbers is 30



Post a Comment

Previous Post Next Post