Reference no: EM132207566
Write a program which:
1. Asks the user to enter a positive integer greater than 0
2. Validates that the entry is a positive integer
3. Outputs the digits in reverse order with a space separating the digits
4. Outputs the even digits not in reverse order with a space separating the digits (consider zero to be even)
5. If there are no even digits, the an appropriate message should be displayed: There are no even digits
6. Outputs the odd digits not in reverse order with a space separating the digits
7. If there are no odd digits, the an appropriate message should be displayed: There are no odd digits
8. Allows user is to repeat/continue the program as many times as he/she wants
9. Keeps a record in a txt file named outDataFile.txt with the history of all numbers entered and the associated results, in the following format:
the original number is 1234
the number reversed 4 3 2 1
the even digits are 2 4
the odd digits are 1 3
-----------------
the original number is 135
the number reversed 5 3 1
There are no even digits
the odd digits are 1 3 5
-----------------
the original number is 862
the number reversed 2 6 8
the even digits are 8 6 2
There are no odd digits
-----------------
GENERAL RESTRICTIONS
No global variables
No infinite loops, examples include:
for(;;;)
while(1)
while(true)
do{//code}while(1);
No break statements to exit loops