如题所述
#include<stdio.h>
void main(int argc, char *argv[])
{ int iNum1,iNum2;
printf("请输入二个数:\n");
scanf("%d %d",&iNum1,&iNum2);
printf("%d+%d=%d\n",iNum1,iNum2,iNum1+iNum2);
printf("%d-%d=%d\n",iNum1,iNum2,iNum1-iNum2);
printf("%d*%d=%d\n",iNum1,iNum2,iNum1*iNum2);
printf("%d/%d=%d\n",iNum1,iNum2,iNum1*iNum2);
}
只需要给iNum1和iNum2赋值为123和456,那么他们的和差积商就可以计算出来。
void main(int argc, char *argv[])
{ int iNum1,iNum2;
printf("请输入二个数:\n");
scanf("%d %d",&iNum1,&iNum2);
printf("%d+%d=%d\n",iNum1,iNum2,iNum1+iNum2);
printf("%d-%d=%d\n",iNum1,iNum2,iNum1-iNum2);
printf("%d*%d=%d\n",iNum1,iNum2,iNum1*iNum2);
printf("%d/%d=%d\n",iNum1,iNum2,iNum1*iNum2);
}
只需要给iNum1和iNum2赋值为123和456,那么他们的和差积商就可以计算出来。
温馨提示:答案为网友推荐,仅供参考
第1个回答 2014-09-25
#include <stdio.h>
int main(){
float x = 123.0;
float y = 456.0;
int a = x + y;
int h = x - y;
int m = x * y;
float di = x / y;
printf ("addition: %d\n",a);
printf ("difference: %d\n",h);
printf ("multiplication: %d\n",m);
printf ("division: %f",di);
return 0;
}
int main(){
float x = 123.0;
float y = 456.0;
int a = x + y;
int h = x - y;
int m = x * y;
float di = x / y;
printf ("addition: %d\n",a);
printf ("difference: %d\n",h);
printf ("multiplication: %d\n",m);
printf ("division: %f",di);
return 0;
}
第2个回答 2014-09-25
#include<stdio.h>
void main(){
int a=123,b=456;
double c=(double)a/b;
printf("a+b=%d\n",a+b);
printf("a-b=%d\n",a-b);
printf("a*b=%d\n",a*b);
printf("a/b=%lf\n",c);
}本回答被网友采纳
void main(){
int a=123,b=456;
double c=(double)a/b;
printf("a+b=%d\n",a+b);
printf("a-b=%d\n",a-b);
printf("a*b=%d\n",a*b);
printf("a/b=%lf\n",c);
}本回答被网友采纳