Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a function which will return the value of the largest threeintegers passed

ID: 3614737 • Letter: W

Question

write a function which will return the value of the largest threeintegers passed to it.
Note: the functions should not do any input or output (noscanf or printf).
The prototype of the function is:
int findbig(int, int, int);

Explanation / Answer

I see the return of max some how went missing in my functionabove. Never the less, the code still worked for some reason I don'tknow. Anyway, here is the correct code... It's a little different. Choose which you like. Sometimes the former method is shorter for certaincircumstances. stjohn@beatific ~/programming/cpp $ ./findBig The biggest number between 111, 31337, and 1337 is 31337 stjohn@beatific ~/programming/cpp $ cat findBig.c #include int findBig(int, int, int); int main() {         printf("The biggestnumber between %d, %d, and %d is %d ",                111,                31337,                1337,                findBig(111,31337,1337)                );                return 0; } int findBig(int max, int b, int c) {         if (b > max)                max = b;         else if (c > max)                max = c;         return max; } So, what I am doing is assuming the first parameter is the maximumvalue. I then compare it to the other two parameters. If any of the other two parameters are larger, I call them themaximum value. In the end, I end up with the real maximum number. Is this better? If you are not satisfied with my previous response, say so andwhy. Hope this helps.