Java 16.2 | Sololearn: Learn to code for FREE!

+1

# Java 16.2

I need help :) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); int number = read.nextInt(); while (3<number){ number--; if((number%3==0) && (number!=0)){ System.out.println(number); } } } }

4/19/2021 11:23:51 AM

Igaman Igaman

+1

What help do you want the program is working fine?

+1

Ok just check for multiple of 3 and check if the remainder of the number is 3 or not that's all

+1

Just use this to do it if(number%3==0 || number%10==3)

+1

See the line which I gave you tells that if a number is divisible by 3 or if number%10 or we can say if after the number divided by 10 we get the value as 3

+1

You mean in reverse order?

+1

Then store 3 in a variable and after the condition increase in by 1

+1

Else the values you are getting store it in empty string

+1

Try to do by yourself first

0

The weird client loves the number 3 and wants you to write a program that prints out all numbers from 1 of the entered number that are either multiples of 3 or end in 3. Sample input 14 Result example 3 6 9 12 13

0

I can't print a number with a 3 at the end

0

I did the opposite

0

My result is 13-3

0

I must get 3-13

0

Tell me about please “if(number%3==0 || number%10==3)”, i dont understand

0

Iv got, thank you, but why my the numbers came out the other way around

0

Yeah

0

I dont understand how reverse my result? 13 12 9 6 3 my result, i want 3 6 9 12 13

0

You can write ?

0

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); int number = read.nextInt(); int n=3; if(number>n) { while(n<=number) { if(n%3==0 || n%10==3) System.out.println(n); n++; } } } }

0

But task 4 wrong and closed