#include <stdio.h>
/*
依次将10个数输入并将其最大值输出
soulsjie 2017 05 25
*/
void main (){
int t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; //初始变量
int s1,s2,s3,s4,s5; //第一轮比较后的变量
int jieguo;
int Max(int a ,int b);
printf("请输入10个数用逗号隔开:
");
scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&t1,&t2,&t3,&t4,&t5,&t6,&t7,&t8,&t9,&t10);
printf("10个数是:%d,%d,%d,%d,%d,%d,%d,%d,%d,%d
",t1,t2,t3,t4,t5,t6,t7,t8,t9,t10);
s1=Max(t1,t2); //进行第一轮比较
s2=Max(t3,t4);
s3=Max(t5,t6);
s4=Max(t7,t8);
s5=Max(t9,t10);
jieguo=Max(Max(Max(s1,s2),Max(s3,s4)),s5);
printf("最大值是:%d
",jieguo);
}
int Max(int a ,int b){
int c ;
if(a>b)
c=a;
else
c=b;
return(c);
}