算术基本运算
Time Limit: 1 Sec Memory Limit: 2 MB
Description
计算两整数x和y(0<x,y<1000)的和、差、积、商、余数、x的平方和y的三次方。
Input
输入只有一行,格式见sample。
Output
输出为多行,按顺序每行输出x,y的和、差、积、商、余数、x的平方和y的三次方,格式见sample
Sample Input
x = 11, y = 3
Sample Output
x + y : 14
x - y : 8
x * y : 33
x / y quotient: 3, remainder: 2
x ^ 2 : 121
y ^ 3 : 27
HINT
注意输入输出格式。了解C语言整数除法运算符的特点,并且没有求幂的运算符。
Append Code
代码仅供参考,请勿抄袭
C代码
#include<stdio.h>
int main() {
int x, y;
scanf("x = %d, y = %d", &x, &y);
printf("x + y : %d\nx - y : %d\nx * y : %d\nx / y quotient : %d, remainder : %d\nx ^ 2 : %d\ny ^ 3 : %d", x + y, x - y, x * y, x / y, x % y, x * x, y * y * y);
return 0;
}