1441 - C语言-宏求余
输入两个整数,求他们相除的余数。用带参的宏来实现,编程序。
Input
a b两个数
Output
a/b的余数
Examples
Input
3 2
Output
1
Solution C
#include <stdio.h> #include <math.h> int main () { int a,b,c; scanf("%d%d",&a,&b); c=a%b; printf("%d",c); return 0; }
Solution C++
#include "stdio.h" #define qiuyu(a,b) a%=b; int main(int argc, char* argv[]) { int a,b; while(~scanf("%d%d",&a,&b)) { qiuyu(a,b); printf("%d\n",a); } return 0; }