0
Solution Code for this question.
A client wants you to write a program that prints all numbers from 0 to the inputted number that are either a multiplier of 3 or end with 3. Sample input 14 Sample output 3 6 9 12 13 Here's my try. import java.util.Scanner; class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); int n = read.nextInt(); int o = 0; while (o<n) { if (o%3 ==0 || o%10 ==3) { system.out.println(o); o++; } } } } }
7 odpowiedzi
+ 2
I’m a noob too
well they normally want to see the actually file but this seems like a code coach problem so you only can copy the code you have
+ 1
First show your attempt here bro
0
Where's your attempt?
0
Given, i am noob
0
Error 1: You have a extra } in the code, causes brackets mismatches.
Error 2: system -> System at system.out.println()
Finally, you only increases o when the if statement is true. This causes infinity loop. You should put it out of the if statement so o will be increased no matter what.
0
Exactly, Jennisha
0
Still not working CarrieForle