Home C Language Basic C Programs Biggest of Three Numbers in C

Biggest of Three Numbers in C

Write a C Program to demonstrate “nested if”

(or)

Write a C Program to find Biggest among three numbers.

#include<stdio.h>

int main()

{

   int a,b,c;

   printf(“Enter three values :\n”);

   scanf(“%d%d%d”,&a,&b,&c);

   if(a < b)

   {

      if(b < c)

         printf(“%d is the biggest among three\n”,b);

      else

         printf(“%d is the biggest among three\n”,c);

   }

   else if(a < c)

      printf(“%d is the biggest among three\n”,c);

   else

      printf(“%d is the biggest among three\n”,a);

   return 0;

}

Output:

Enter three values :

53 175 6

175 is the biggest among three