1969 - 求三个数的最小值
用户任意从键盘输入三个数,用程序判断三个数的最小值并将其输出。
Input
输入三个整数,用空格隔开。
Output
输出最小值,不包含(包括回车在内的)任何其他符合
Examples
Input
22 15 39
Output
15
Hint
无
Solution C
#include <stdio.h> int main() { int a, b, c; scanf("%d %d %d", &a, &b, &c); if (a <= b && a <= c) printf("%d", a); else if (b <= a && b <= c) printf("%d", b); else if (c <= a && c <= b) printf("%d", c); return 0; }
Solution C++
#include<iostream> using namespace std; int main() { int a,b,c; cin>>a>>b>>c; if(a>=b) { if(b>=c) { cout<<c<<endl; } else cout<<b<<endl; } else { if(a>=c) { cout<<c<<endl; } else cout<<a<<endl; } return 0; }
Hint
无