It scans for 2 numbers from every line of input every loop until there are no more lines of the input left. I thought this would work fine but I encountered a problem when I tested out the following input:

1 0
1 1
1 2
1 3

The output should be

1,0.
1,1.
1,2.
1,3.

but instead it prints the last loop twice like this:

1,0.
1,1.
1,2.
1,3.
1,3.

Why does this scan the last line twice before terminating? is there a character I can check for so it ends after it prints the first "1,3."?

If a reading error happens or the end-of-file is reached while reading, the proper indicator is set (feof or ferror). And, if either happens before any data could be successfully read, EOF is returned.

So, when the no more lines of the input left, the scanf() returns EOF and the while loop iterate because done is not set to 1 yet and printf() prints the value stored in next and next1 one more time. That's why the last entered value printed twice. After this the condition if (getchar()=='\n') fails and done set to 1 and while loop exits.