请用C++写出问题:输入两个整数,求出它们的商和余数的程序代码:
时间: 2024-05-03 12:19:56 浏览: 79
下面是用C语言写的输入两个整数,求出它们的商和余数的程序代码:
```
#include <stdio.h>
int main()
{
int dividend, divisor, quotient, remainder;
printf("请输入被除数和除数:");
scanf("%d %d", ÷nd, &divisor);
quotient = dividend / divisor;
remainder = dividend % divisor;
printf("商为 %d,余数为 %d\n", quotient, remainder);
return 0;
}
```
阅读全文