printf("Please input the two numbers:\n",x,y);
这样可以吗?
这样可以吗?
#include "stdio.h"
#define L(a,b) a%b
main()
{
int x,y,t;
printf("Please input the two numbers:\n",x,y);
scanf("%d%d\n",&x,&y);
t=L(x,y);
printf("%d\n",t);
}
输入5,4
但是结果却是5.
scanf定义格式与输入格式不符(红字部份)
修改成如下:
#include "stdio.h"
#define L(a,b) a%b
main()
{
int x,y,t;
printf("Please input the two numbers:\n",x,y);
scanf("%d,%d",&x,&y);
t=L(x,y);
printf("%d\n",t);
}
输入5,1
结果为1