Input is 0-5 million
Find all numbers within the input that are:
Odd
Divisible by 17
Output those numbers
This is what I have for now, not sure how to proceed:
for (int i = 0; i < 5000001; i++) {
if (i % 2==0){
I’m sure that the for loop needs to be used, not sure how to find if it’s divisible by 17.
There was a similar question on here already, however it was in python.
>Solution :
Here is the code :-
int num = 0;
while(num +17 <= 5000000){
num = num +17;
if(num % 2 == 0){
System.out.print(num+ " ");
}
}
System.out.println("Done");