C program to find largest among three numbers

C program to find largest among three numbers


#include<stdio.h>

int main()

{

   int a,b,c;

   printf("Enter your three numbers\n");

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

   //use else if statement to compare them

   if((a>b & a>c))

   {

printf("a is greater");

  }

   else if((b>a & b>c))

   {

    printf("b is greater");

   }

    else

   printf("c is greater");

  return 0;

}

Output:

Enter your three numbers

12

43

66

c is greater




Description:-

1. First take any three numbers and then simply apply else if condition to compare three numbers and at last you will get higher number.