topic:
Calculate A + B.
1 1
2
解题思路:
注意题目的each line即可输入任意行的数字,每行两个数,求每行两数之和并按每行一个的形式输出。
常见错误解法:
#include <stdio.h> #include <stdlib.h> int main() { int a,b; printf("input two integer(a,b):\n"); scanf("%d,%d\n",&a,&b); printf("a+b=%d\n",a+b); return 0; } 此时你发现程序本身没错,但提交系统错误,原因在于没有理解清楚题目表达的接受任意行数字的输入和输出
正确解法:
#include <stdio.h> #include <stdlib.h> int main() { int a,b;