Loop problem

so i made this program where i have to reverse a number the prog attached below …now my question is when i enter the values
4
12345678
2435768
12345
31203
out put is
87654321
8675342
54321
30213 which is fine but when i entered all the values alltogether where where they stored and where was the result kept what is the procedure…what i am tryn to say is when 12345678 was entered the number was kept in a variable right…but again when 2435768 was enterd in the next line where was this number stored and where was the result stored