Program to print the largest of three numbers in C

#include <stdio.h>
int main()
{ 
int a, b, c;
   printf( "Enter three numbers: \n") ;
   scanf( "%d%d%d", &a, &b, &c) ;
if( a>=b && a>=c)
        printf( " \n%d is the largest number.\n",a) ;
if( b>=a && b>=c)
        printf( " \n%d is the largest number.\n",b) ;
if( c>=a && c>=b)
        printf( " \n%d is the largest number.\n",c) ;
return 0;
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.