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
Submit
#include<stdio.h>
int main()
{
int a
,b
;
scanf("x = %d, y = %d",&a
,&b
);
printf("x + y : %d\n",a
+b
);
printf("x - y : %d\n",a
-b
);
printf("x * y : %d\n",a
*b
);
printf("x / y quotient: %d, remainder: %d\n",a
/b
,a
%b
);
printf("x ^ 2 : %d\n",a
*a
);
printf("y ^ 3 : %d\n",b
*b
*b
);
return 0;
}
转载请注明原文地址: https://lol.8miu.com/read-37286.html