第1个回答 推荐于2017-12-15
#include "stdio.h"
main()
{ int a,b;
printf("请输入两个整数(a,b):");
scanf("%d,%d",&a,&b);
printf("和:%d\n",a+b);
printf("差:%d\n",a-b);
printf("积:%d\n",a*b);
printf("商:%f\n",(float)a/b);
}
/*如果满意,请采纳!*/本回答被提问者采纳
第2个回答 2010-11-13
#include <iostream>
using namespace std;
int main(){double a,b;
cout<<"请输入两个数(注意间隔)"<<endl;
cin>>a>>b;
cout<<"和="<<a+b<<endl;
cout<<"差="<<a-b<<endl;
cout<<"积="<<a*b<<endl;
if(b==0)
cout<<"除数不能为0"<<endl;
else cout<<"商="<<a/b<<endl;
return 0;
}
第3个回答 2019-03-01
int main()
{
int num1,num2;
int a,b,c;
double d;
printf ("请输入两个整数\n",num1,num2);
scanf ("%d %d",&num1,&num2);
if(num2==0){
printf ("除数不能为0,请重新输入\n");
return 0;
}
else
a = num1 + num2;
b = num1 - num2;
c = num1 * num2;
d = 1.0* num1 / num2;
printf ("%d + %d = %d\n%d - %d = %d\n",num1,num2,a,num1,num2,b);
printf ("%d * %d = %d\n%d / %d = %.2lf\n",num1,num2,c,num1,num2,d);
return 0;
}
第4个回答 2010-11-13
// ForPEE.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
void get()
{
int a = 0;
int b = 0;
scanf("%d",&a);
scanf("%d",&b);
char sTemp[128 + 1] = {0};
sprintf(sTemp,"%d\n",a+b);
printf(sTemp);
sprintf(sTemp,"%d\n",a-b);
printf(sTemp);
sprintf(sTemp,"%d\n",a*b);
printf(sTemp);
sprintf(sTemp,"%d\n",a/b);
printf(sTemp);
}
int main()
{
get();
return 0;
}