这两种是不是都是对的?都能得到同样的结果,有没有什么区别?
#include <stdio.h>
int main()
{
int x = 10, y = -3;
printf("x+y=%d\n", x + y);
printf("x-y=%d\n", x - y);
printf("x*y=%d\n", x * y);
printf("x/y=%d\n", x / y);
printf("x%y=%d\n", x % y);
return 0;
}
======================
#include <stdio.h>
int main()
{
int x,y;
x = 10;
y = -3;
printf("x+y=%d\n",7 );
printf("x-y=%d\n", 13 );
printf("x*y=%d\n", -30 );
printf("x/y=%d\n", -3 );
printf("x%y=%d\n", 1 );
return 0;
}
======================