I am very new to C programming and am tying to complete a homework assignment, but I can't get the values to return correctly and have no idea what to change.
I thought that I should replace the %d with %f, but that still doesn't return the correct results.
Any guidance is appreciated!
This is the exercise:
Devise a function called min(x,y) that returns the smaller of two double values. Test the function with a simple driver.
This is the code I have:
double imin(double, double);
double num1, num2;
printf("Enter a pair of numbers (q to quit):\n");
while (scanf("%d %d", &num1, &num2)==2);
printf("The smallest number of %f and %f is %f. \n",
num1, num2, imin(num1, num2));
double imin(double x, double y)
return (x < y) ? x : y;