編寫壹個C程序,運行時輸入a,b,c三個值,輸出其中值最大者的步驟:
1、首先輸入三個數,求三個數中的最大值
#include<stdio.h>
int?main(){int?max(int?x,int?y,int?z);int?a,b,c,m;scanf("%d,%d,%d",&a,&b,&c);m=max(a,b,c);printf("the?max?number?is?%d\n",m);return?0;}
2、然後輸入
int?max(int?x,int?y,int?z){int?max2(int?a,int?b);int?temp,result;temp=max2(x,y);result=max2(temp,z);return(result);
}
3、最後輸入
int?max2(int?a,int?b){int?q;if(a>b)q=a;else?q=b;return(q);}即可。