smallfloat.c (498B)
1 /* Exercise 5.25 */ 2 3 float smallfloat(float, float, float); 4 5 int main() 6 { 7 float num1, num2, num3; 8 9 printf("Give me 3 float numbers: "); 10 scanf("%f%f%f", &num1, &num2, &num3); 11 printf("Smallest is %.2f\n", smallfloat(num1, num2, num3)); 12 13 return 0; 14 } /* E0F main */ 15 16 /* return the smallest of three float numbers */ 17 float smallfloat(float x, float y, float z) 18 { 19 if(x <= y && x <= z) 20 return x; 21 else if(y < z) 22 return y; 23 else 24 return z; 25 26 } /* eof smallfloat() */ 27