I am a Java programmer, but currently solving some online problems on C platform. I want to stop reading input when no input is read from console. Its like this
Input :
1
2
3
4
Output :
1
2
3
4
But in advance, I do not know how many no.s I will read. As many of you may be knowing that online judges feed input from a file. So how to stop reading data from console when no data is fed from console ?
Sorry for very stupid question.
fgets.