Q:

EXAMPLE C PROGRAM TO FIND LARGEST OF GIVEN 3 NUMBERS

0

EXAMPLE C PROGRAM TO FIND LARGEST OF GIVEN 3 NUMBERS:

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include 
 
int main(){
 
      float a, b, c;
 
      printf("\nPlease enter 3 numbers:");
 
      scanf("%f %f %f", &a, &b, &c);
 
      if(a>=b && a>=c)
 
         printf("\nThe largest number is %f", a);
 
      if(b>=a && b>=c)
 
         printf("\nThe largest number is %f", b);
 
      if(c>=a && c>=b)
 
         printf("\nThe largest number is %f", c);
 
      return 0;
 
}

output: 

Please enter 3 numbers: 2 4 5 

The largest number is 5.000000

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now