Hi, I'm looking for help with a homework question. Any assistance will be greatly appreciated. Essentially, I am supposed to write a function (max_of_3), and call it in the main function. I'm getting a logical error, so please tell me if you notice any redundancies or wrong steps I have taken. (Don't mind the part comments.. There were individual parts for my assignment.) The function is supposed to take in three numbers, and find and return the largest of the three. If you look under the issue comment, you will see where I have attempted to call the function to display it.

Code:#include <stdio.h> int max_of_3(int x, int y, int z) { int l; if (x > y && x > z) l = x; else if (y > x && y > z) l = y; else if (z > x && z > y) l = z; return (l); } int main(void) { /*Part 1 & 2*/ int a, b, c, larger, largest, largest1, smaller, smallest, x, y, z; printf ("Enter a number: "); scanf ("%d %d %d", &a, &b, &c); printf ("\nThe first number entered was %d.", a); printf ("\nThe second number entered was %d.", b); printf ("\nThe third number entered was %d.", c); /*Part 3 & 4*/ if (a > b) larger = a; else larger = b; printf ("\n\n%d is the larger number of the first two.", larger); if (larger > c) largest = larger; else largest = c; printf ("\n\n%d is the largest number.", largest); /*Part 6*/ if (a > b) smaller = b; else smaller = a; printf ("\n\n%d is the smaller number of the first two.", smaller); if (smaller > c) smallest = c; else smallest = smaller; printf ("\n\n%d is the smallest number.", smallest); /*Part 7*/ printf ("\n\n%d is the middle number.", a+b+c-smallest-largest); /*Part 8*/ printf ("\n\nFrom least to greatest, the numbers are: %d, %d, %d.", smallest, a+b+c-smallest-largest, largest); /*issue*/ largest1 = max_of_3(x, y, z); printf ("\n\n\n\n %d", largest1); return (0); }

Again, any help is very much appreciated. Thanks.