1021: 三个整数的最大值

题目描述

从键盘输入三个整数x,y和z,求出其中最大的数。

输入

输入三个整数,用空格隔开。

输出

输出最大整数。

样例输入 Copy
20 16 18
样例输出 Copy
20
 
编译环境:
VS
代码:
 
 
 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 #include <math.h>
 4 int main()
 5 {
 6     int x, y, z,max;
 7     scanf("%d %d %d",&x,&y,&z);
 8     if (x > y) {
 9         max = x;
10     }
11     else {
12         max = y;
13     }
14     if (z > max) {
15         max = z;
16     }
17     printf("%d",max);
18     return 0;
19 }

 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

posted on 2019-08-21 19:59  涟涟  阅读(674)  评论(0)    收藏  举报

导航