0

Help Java Loop [SOLVED]

The program supposed to print the number input and decrease it down to 0 skipping numbers that are a multiple of 3 but my code doesn't skip those numbers. Help please https://code.sololearn.com/c4q6cSBbkcGg/?ref=app

2nd Mar 2021, 6:41 AM
Rjmcdxx
Rjmcdxx - avatar
4 Antworten
0
if(number==0){ System.out.println(number); number--;} else{ //My previous answer }
2nd Mar 2021, 8:23 AM
Vadivelan
+ 1
Change the code like below: if (number % 3 == 0){ number--; continue ; } System.out.println (number); number--;
2nd Mar 2021, 7:15 AM
Vadivelan
0
It now doesn't print 0
2nd Mar 2021, 7:28 AM
Rjmcdxx
Rjmcdxx - avatar
0
for(int i =input ; i>=0 ; i--){ if(i%3==0){ continue; } else{ print(i); } }
2nd Mar 2021, 1:58 PM
Mohammad
Mohammad - avatar