C语言编程:输入整数a和b,如果a能被b整除,就输出算式和商,否则输出算式、整数商和余数。
时间: 2024-05-15 07:16:46 浏览: 54
```c
#include <stdio.h>
int main()
{
int a, b, quotient, remainder;
printf("请输入两个整数a和b:\n");
scanf("%d%d", &a, &b);
if (a % b == 0) {
quotient = a / b;
printf("%d/%d=%d\n", a, b, quotient);
} else {
quotient = a / b;
remainder = a % b;
printf("%d/%d=%d...%d\n", a, b, quotient, remainder);
}
return 0;
}
```
阅读全文