You could try using a do while loop to get the number from the user and to display the error message if the number is incorrect
Then use a for loop to print the number.



do
{
...