Remember to clean the variables before starting each process.
You can also choose to use a for loop to request each number, instead of the while , taking advantage of the fact that you can know the number of iterations, thanks to the variable con2 .