C语言 求大神改成正确的 题目是:输入两个整数num1和num2,计算并输出它们的和、差、积、商和余数#include int main(void){ int num1,num2; int x,y,z,k,j;print("Enter num1=",num1);scanf("%d",&num1);print("Enter num2=",num2);scanf("%d",&num2); x=num1+num2; y=num1-num2; z=num1*num2; k=num1/num2; j=num1%num2;print("num1+num2=x",x);print("num1-num2=y",y);print("num1*num2=z",z);print("num1/num2=k",k);print("num1%num2=j",j);return 0;}我上C语言就4节课 新手我把下面改成printf("num1+num2=%d",x);printf("num1-num2=%d",y

问题描述:

C语言 求大神改成正确的 题目是:输入两个整数num1和num2,计算并输出它们的和、差、积、商和余数
#include
int main(void)
{ int num1,num2;
int x,y,z,k,j;
print("Enter num1=",num1);
scanf("%d",&num1);
print("Enter num2=",num2);
scanf("%d",&num2);
x=num1+num2;
y=num1-num2;
z=num1*num2;
k=num1/num2;
j=num1%num2;
print("num1+num2=x",x);
print("num1-num2=y",y);
print("num1*num2=z",z);
print("num1/num2=k",k);
print("num1%num2=j",j);
return 0;
}
我上C语言就4节课 新手
我把下面改成printf("num1+num2=%d",x);
printf("num1-num2=%d",y);
printf("num1*num2=%d",z);
printf("num1/num2=%d",k);
printf("num1%num2=%d",j);
提醒成功编译,但有警告信息.
xfc2_6.c: In function ‘main’:
xfc2_6.c:5: warning: too many arguments for format
xfc2_6.c:7: warning: too many arguments for format
xfc2_6.c:18: warning: format ‘%n’ expects type ‘int *’, but argument 2 has type ‘int’
xfc2_6.c:18: warning: too few arguments for format
有什么要改的吗? 谢谢
额 最后格式还要这样的
Enter num1:5
Enter num2:3
5+3=8
5-3=2
5*3=15
5/3=1.67
5%3=2