C中计算变量A/B的余数为什么要2个%main(){ int a,b,c,d,e,f,g; scanf("%d%d",&a,&b); c=a+b; d=a-b; e=a*b; f=a/b; g=a%b; printf("a+b=%d\n",c); printf("a-b=%d\n",d); printf("a*b=%d\n",e); printf("a/b=%d\n",f); pr

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/26 23:14:08
C中计算变量A/B的余数为什么要2个%main(){inta,b,c,d,e,f,g;scanf("%d%d",&a,&b);c=a+b;d=a-b;e=a*b;f=a/b;g=a%b

C中计算变量A/B的余数为什么要2个%main(){ int a,b,c,d,e,f,g; scanf("%d%d",&a,&b); c=a+b; d=a-b; e=a*b; f=a/b; g=a%b; printf("a+b=%d\n",c); printf("a-b=%d\n",d); printf("a*b=%d\n",e); printf("a/b=%d\n",f); pr
C中计算变量A/B的余数为什么要2个%
main(){   int a,b,c,d,e,f,g;   scanf("%d%d",&a,&b);   c=a+b;   d=a-b;   e=a*b;   f=a/b;   g=a%b;   printf("a+b=%d\n",c);   printf("a-b=%d\n",d);   printf("a*b=%d\n",e);   printf("a/b=%d\n",f);   printf("a%%b=%d\n",g);   getch();} 上面  printf("a%%b=%d\n",g);请自己说清楚点 别跟我别人那复制

C中计算变量A/B的余数为什么要2个%main(){ int a,b,c,d,e,f,g; scanf("%d%d",&a,&b); c=a+b; d=a-b; e=a*b; f=a/b; g=a%b; printf("a+b=%d\n",c); printf("a-b=%d\n",d); printf("a*b=%d\n",e); printf("a/b=%d\n",f); pr
printf("a%%b=%d\n",g);这个是函数printf的参数规则,%%输出一个%号
目的是输出:a%b=g