运算符 | 描述 | 示例 |
---|---|---|
* |
乘法 | fResult = fOperand1 * fOperand2; |
/ |
除法 | fResult = fOperand1 / fOperand2; |
% |
模数(余数) | fRemainder = fOperand1 % fOperand2; |
+ |
加法 | fResult = fOperand1 + fOperand2; |
- |
减法 | fResult = fOperand1 ? fOperand2; |
#include <stdio.h>
int main() {
int iOperand1 = 0;
int iOperand2 = 0;
int iResult = 0;
printf("/n/tAdder Program/n");
printf("/nEnter first operand: ");
scanf("%d", &iOperand1);
printf("Enter second operand: ");
scanf("%d", &iOperand2);
iResult = iOperand1 + iOperand2;
printf("The result is %d/n", iResult);
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/266775.html