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语言程序,该程序用于读取输入文件中的整数并计算它们的和。文章通过示例展示了如何使用while循环和scanf函数处理输入,并通过printf函数输出结果。适合初学者学习。
423

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



