[C language] to create a function and call compare the size of three numbers

#include <stdio.h>
 int max(int x,int y,int z)
{
if(x>=y)
if(x>=z)
return x;
else
return z;
else
if(y>=z)
return y;
else
return z;
}
main()
{
int a,b,c; 
printf ( " Please enter the three numbers: \ the n- " );
scanf("%d%d%d",&a,&b,&c);
the printf ( " maximum value of: D% \ n- " , max (A, B, C));
}

 

Guess you like

Origin www.cnblogs.com/HGNET/p/11943019.html