#include
#include
int main(void)
{
printf("%d
",3%5); //3 3=5*0+3
printf("%d
",5%3); //2 5=3*1+2
printf("%d
",3%-5); //3 3=-5*0+3
printf("%d
",-3%-5); //-3 -3=-5*0+3
printf("%d
",-3%5); //-3 -3=5*0+3
printf("%d
",5%-3); //2 5=-3*-1+2
system("pause");
return 0;
}
解释:
例如:a%b
一定化成 a=b*n+k;
结果为 :k