I try to do this exercise:

Write a program that asks the user to select a positive integer n, and prints all the odd numbers from 1 to n.
Add to the previous program a question to the user whether to print even or odd numbers. If the user clicks 1, the program will print odd, and if he clicks 2 it will print even (without ‘0’). If he clicks something else, the program will print an appropriate error message and end.

someone can tell me what wrong with my code?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.