题解 | #简单运算#
简单运算
https://www.nowcoder.com/practice/23c9b22d40fa4d7698a1306fb0c9f975
#include <iostream>
using namespace std;
int main() {
// 四则运算
int a, b;
cin >> a >> b;
if (1 <= a <= 9999 && 1 <= b <= 9999 && a > b)
cout << a+b <<" "<< a-b <<" "<< a*b <<" "<< a/b << " "<< a % b;
if (1 <= a <= 9999 && 1 <= b <= 9999 && a < b)
cout << a+b <<" "<< b-a <<" "<< a*b <<" "<< b/a <<" "<< b % a;
return 0;
}
C++每日一练 文章被收录于专栏
C++刷题
查看5道真题和解析