耐撕涂油
2019-06-12 17:28
有点懵懵的不太会 求助大神
#include <stdio.h>
int main()
{
int x,y;
x = 10;
y = -3;
int a = x+y;
int b = x-y;
int c = x*y;
int d = x/y;
int e = x%y;
printf("x+y=%d\n",a);
printf("x-y=%d\n",b);
printf("x*y=%d\n",c);
printf("x/y=%d\n",d);
printf("x%%y=%d\n",e);
return 0;
}
再给定义五个量表示运算之后的结果,根据题目赋予这五个量表达式,最后把这五个量放进输出
#include <stdio.h>
int main()
{
int x,y,M1,M2,M3,M4,M5;
x = 10;
y = -3;
M1=x+y;
M2=x-y;
M3=x*y;
M4=x/y;
M5=x%y;
printf("x+y=%d\n", M1 );
printf("x-y=%d\n", M2 );
printf("x*y=%d\n", M3 );
printf("x/y=%d\n", M4 );
printf("x%%y=%d\n", M5 );
return 0;
}
上面说的在第六行,直接把第七行复制粘贴到第六行,上述直接给出x=5,y=8. 现在要z = x*8/y+2=4?所以加个括号足矣, z = x*8/(y+2)
C语言入门
926209 学习 · 20797 问题
相似问题