Problem Description
Calculate A + B.
Input
Each line will contain two integers A and B. Process to end of file.
Output
For each case, output A + B in one line.
Sample Input
1 1
Sample Output
2
Author
HDOJ
int main()
{
int a,b;
while(scanf("%d %d",&a,&b)!=EOF)
{
printf("%d\n",a+b);
}
return 0;
}
注意while(scanf("%d %d",&a,&b)!=EOF)的使用.
C语言求和程序解析
本文介绍了一个简单的C语言程序,该程序用于读取输入文件中的整数对,并计算每一对整数的和。文章提供了完整的代码示例,并解释了如何使用while循环结合scanf函数来处理输入数据。
474

被折叠的 条评论
为什么被折叠?



