#include <stdio.h>
#include <math.h>
double minimum(double x, double y, double z)
{
double temp = 0;
if (isnan(x) || isnan (y) || isnan(z))
return NAN;
temp = (x < y) ? x : y;
return (temp < z)? temp : z;
}
int main(void) {
double x, y, z, minVal;
printf("Please enter three numeric values: ");
scanf("%lf%lf%lf", &x, &y, &z);
minVal = minimum(x, y, z);
printf("minimum(%0.10f, %0.10f, %0.10f) = %0.10f\n", x, y, z, minVal);
return 0;
}
5
solved Using a function to find the minimum of three values [closed]