+ 1
Help with “Being Choosy” While Loop Challenge
Hey guys, I’m having trouble having my code “print all numbers from 1 to the inputted number that are either a multiplier of 3 or end with 3.” (3,6,9,12,13) public static void main (String[] args{ Scanner read=new Scanner(System.in); int number = read.nextInt() //your code goes here int count = 3; while (count < number){ if(count % 3 == 3 || count % 10 ==3); System.out.println(count); count++; } } }
2 ответов
+ 3
Do not modify the given code! That is:
number = read.nextInt()
Start counting from 1 and go up until number + 1 (or <= number)
+ 2
ain't number = read.next()
That is a questionable choice of data type.
EDIT: I see that you corrected it after my comment.