+ 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); } } } }

19th Apr 2021, 11:23 AM
Igaman Igaman
Igaman Igaman - avatar
26 Answers
+ 3
You mean in reverse order?
19th Apr 2021, 2:34 PM
Atul [Inactive]
+ 3
Else the values you are getting store it in empty string
19th Apr 2021, 4:27 PM
Atul [Inactive]
+ 2
Try to do by yourself first
19th Apr 2021, 5:48 PM
Atul [Inactive]
+ 2
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); int number = read.nextInt(); int i=3; while (i<number){ if(i%3==0 || i%10==3){ System.out.println(i); } i++; } } } //Check out for this
20th Apr 2021, 4:19 PM
Atul [Inactive]
+ 2
To make task 4 work too, add "=". Namely, in the condition "while" while (i <= number)
15th Oct 2021, 3:35 PM
Lucifer_13th
Lucifer_13th - avatar
+ 1
What help do you want the program is working fine?
19th Apr 2021, 12:13 PM
Atul [Inactive]
+ 1
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
19th Apr 2021, 12:21 PM
Igaman Igaman
Igaman Igaman - avatar
+ 1
Ok just check for multiple of 3 and check if the remainder of the number is 3 or not that's all
19th Apr 2021, 12:28 PM
Atul [Inactive]
+ 1
I can't print a number with a 3 at the end
19th Apr 2021, 12:30 PM
Igaman Igaman
Igaman Igaman - avatar
+ 1
I did the opposite
19th Apr 2021, 2:16 PM
Igaman Igaman
Igaman Igaman - avatar
+ 1
My result is 13-3
19th Apr 2021, 2:20 PM
Igaman Igaman
Igaman Igaman - avatar
+ 1
Then store 3 in a variable and after the condition increase in by 1
19th Apr 2021, 2:53 PM
Atul [Inactive]
+ 1
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++; } } } }
20th Apr 2021, 2:54 PM
Igaman Igaman
Igaman Igaman - avatar
+ 1
But task 4 wrong and closed
20th Apr 2021, 2:55 PM
Igaman Igaman
Igaman Igaman - avatar
+ 1
Hope this helps you
20th Apr 2021, 4:24 PM
Atul [Inactive]
+ 1
This task done !) thank you !)
20th Apr 2021, 4:25 PM
Igaman Igaman
Igaman Igaman - avatar
+ 1
My pleasure
20th Apr 2021, 4:32 PM
Atul [Inactive]
0
Just use this to do it if(number%3==0 || number%10==3)
19th Apr 2021, 1:06 PM
Atul [Inactive]
0
I must get 3-13
19th Apr 2021, 2:20 PM
Igaman Igaman
Igaman Igaman - avatar
0
Tell me about please “if(number%3==0 || number%10==3)”, i dont understand
19th Apr 2021, 2:21 PM
Igaman Igaman
Igaman Igaman - avatar