This is obviously a "Homework style" task, but I have issues with grasping how I can exclude a certain set of numbers. I understand how I can write out the odd numbers from 0-100, but I fail to comprehend any answers I've found, or tried to find, about how to exclude pre-set numbers of choice.
Basically, what I want to happen is the following: The program writes all odd numbers from 1-100. Lets say I don't want the numbers 5,9 or 11 to be displayed, but I want my program to continue, how do I make that happen?
I have two different sets of code (I don't know which is easier to use in this context, so I'm including both of them):
for (int i=0; i<100; i++)
if (i % 2 !=0)
System.out.println(i)
and
for (int i=1; i<100; i=i+2)
System.out.println(i)