2453 - 整除与求余
从键盘读入两个整数,分别求出两个整数的整数商和余数。
题目输入
输入为一行,两个数之间用空格隔开。
题目输出
在一行中分别输出商和余数,中间用空格隔开。行末输出一个换行符。
输入/输出样例
题目输入
9 2
题目输出
4 1
C语言解答
#include<stdio.h> int main() { int a,b,c,d; scanf("%d%d",&a,&b); c=a/b; d=a%b; printf("%d ",c); printf("%d\n",d); return 0; }
C++解答
#include<stdio.h> int main() { int a,b,c,d; scanf("%d%d",&a,&b); c=a/b; d=a%b; printf("%d %d",c,d); return 0; }