使用函数输出两个数的最大值

使用函数输出两个数中的最大值:

其中:第一行输入一个整数n,代表有n组测试数据;

后面输出的是两个值中较大的一个,每组测试数据占一行。

 1 #include<stdio.h>
 2 int max(int x,int y);
 3  int main(void)
 4  {
 5      int a,b,c;
 6      int n,i;
 7      scanf("%d",&n);
 8      for(i=0;i<n;i++){
 9          scanf("%d%d",&a,&b);
10          int c=max(a,b);
11          printf("最大值是:%d
",c);
12      }
13      return 0;
14  }
15  int max(int x,int y)
16  {
17      int z;
18      z=x>y?x:y;
19      return z;
20  }
原文地址:https://www.cnblogs.com/flqcchblog/p/4543417.html