0

Help w/ Being Choosy Excercise

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); int number = read.nextInt(); //your code goes here int i = 0; while (i <= number && number % 3 == 0) { System.out.println(i); i++; } } ^ STUCK ON THIS EXCERCISE

28th Feb 2021, 11:27 PM
Antonio
Antonio - avatar
1 Réponse
- 1
First of all, you wrote && (and) and you need OR ||. Like this: //your code goes here int i = 1; while (number >=i) { if (i%3==0 || i%10==3){ System.out.println(i); } i++; }
21st Aug 2021, 11:29 AM
DarthMeow
DarthMeow - avatar