Write a C program to find the largest number among three numbers.

First open CodeBlocks and create a file.Then save the file named test.cpp.Then write the following simple C code.Finally Run the Code.

Code:


#include<stdio.h>
int main()
{
int a,b,c,max;
printf("Enter Three Numbers:\n");
scanf("%d%d%d",&a,&b,&c);
if(a>b)
{
 if(a>c)
  {
   max=a;
  }
 else
  {
   max=c;
  }
}
else
{
  if(b>c)
   {
     max=b;
   }
  else
   {
     max=c;
   }
}
printf("The Maximum Number is %d",max);
return 0;
}

Output: