Home > Back-end >  I want to know where is wrong, Max input value is equal to 1 only
I want to know where is wrong, Max input value is equal to 1 only

Time:09-16

# include
Int main ()
{
Int Max (int x, int y, int z);
Int a, b, c, v.
The scanf (" % d % d % d, & amp; A, & amp; B, & amp; C ");
V=Max (a, b, c);
Printf (" Max=% d \ n ", v);
return 0;
}
Int Max (int x, int y, int z)
{
int n;
If (x> Y) n=x;
The else n=y;
If (z> Y) n=z;
The else n=y
}

CodePudding user response:

Function can be run, is to run after input three values, Max=1

CodePudding user response:

The Max function inside leakage return n;

CodePudding user response:

And the inside of the Max function logic nor too to
int n;
If (x> Y) n=x;
The else n=y;

If (z> N) n=z;
return n;

CodePudding user response:

reference xdn1ce reply: 3/f
and the inside of the Max function logic nor too to
int n;
If (x> Y) n=x;
The else n=y;

If (z> N) n=z;
return n;

Max function missed the return n, the main function the scanf format have the wrong number

CodePudding user response:

Function declarations are wrong, Max function declarations in front of the main function

CodePudding user response:

Don't functions defined inside
  • Related