Find largest of three numbers in C language

 WAP to find the greatest of three numbers.


#include <stdio.h>

#include<conio.h>

void main() 

{

  int a, b, c;

 clrscr();

  printf("Enter three different numbers: ");

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

  if (a > b && a > c)

    printf("%d is the largest number.", a);

 else if (b >c)

    printf("%d is the largest number.", b);

 else

    printf("%d is the largest number.", c);

  getch();

}


Output

Enter three different numbers: 10 20 30

30 is the largest number.


Post a Comment

0 Comments