题目要求:
求用户输入的两个数的商,程序运行时,以如下格式输入数据: Input two integers:4 2↙ 请改正程序中的错误,使它能得出正确的结果。
题目代码:
#include <stdio.h>
main()
{
int a, b, c;
printf("Input two integers:");
scanf("%d %d", &a, &b);
c = a\b;
printf("The quotient of a and b is :%d", c);
}
正确代码:
#include <stdio.h>
main()
{
int a, b, c;
printf("Input two integers:");
scanf("%d %d", &a, &b);
c = a/b; //除法符号错误
printf("The quotient of a and b is :%d", c);
}