C语言初学 比较五个整数并输出最大值和最小值1

#include<stdio.h>

#include<math.h>

int max(int x,int y)   

{

if(x>y)

return x;

else

return y;

}

int min(int x,int y)

{

if(x<y)

return x;

else

return y;

}

int main()

{

int x,y,a,b,c,d,e,f,g,h,i,t,o,p,l; printf("输入任意五个整数: ");scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);

    f=max(a,b);

    g=max(f,c);

    h=max(g,d);

    i=max(h,e);

    t=min(a,b);

    o=min(t,c);

    p=min(o,d);

    l=min(p,e);      

    printf("max=%d,min=%d ",i,l);

}

原文地址:https://www.cnblogs.com/lj-1568/p/4380203.html