#include <stdio.h>
int main (void)
{
int A, B;
while (scanf ("%d%d", &a, &b) ==2)
printf ("%d\n", a+b);
return 0;
}SCANF ("%d,%d,%d", &a,&b,&c); if there is a comma between the%d,%d,%d, enter the data with a comma, if the comma is omitted, the input is not a comma, and the Space, TAB key or enter to separate the individual data return value of scanf
The scanf () function returns the number of data items that were successfully assigned, and EOF is returned when an error is read to the end of the file.
Such as:
scanf ("%d,%d", &a, &b);
If both A and B are read successfully, then the return value of scanf is 2.
If only a is successfully read in, the return value is 1
If both A and B are not successfully read, the return value is 0
If an error is encountered or an end of file is encountered, the return value is EOF.
And the return value is of type int.
A small example of infinite input (from the great God Classmate Friendship guidance)