Q:

C program to find smallest of given 3 numbers

0

C program to find smallest 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("The smallest number is %.3f", a);
 
      if(b<=a && b<=c)
 
         printf("The smallest number is %.3f", b);
 
      if(c<=a && c<=b)
 
         printf("The smallest number is %.3f", c);
 
      return 0;
 
}

output:

Please enter 3 numbers: 3  4 5

The smallest number is 3.000

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