public class evenodd {
public static void main(String[] args) {
{
int n = 10;
System.out.print("Even Numbers from 1 to "+n+" are: ");
for (int i = 1; i <= n; i++) {
//if number%2 == 0 it means its an even number
if (i % 2 == 0) {
System.out.print(i + " ");
}
}
}
int o = 10;
System.out.print("Odd Numbers from 1 to "+o+" are: ");
for (int a = 1; a <= o; a++) {
if (a % 2 != 0) {
System.out.print(a + " ");
}
}
}
}