+ 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); } } } }
26 odpowiedzi
+ 3
You mean in reverse order?
+ 3
Else the values you are getting store it in empty string
+ 2
Try to do by yourself first
+ 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
+ 2
To make task 4 work too, add "=". Namely, in the condition "while"
while (i <= number)
+ 1
What help do you want the program is working fine?
+ 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
+ 1
Ok just check for multiple of 3 and check if the remainder of the number is 3 or not that's all
+ 1
I can't print a number with a 3 at the end
+ 1
I did the opposite
+ 1
My result is 13-3
+ 1
Then store 3 in a variable and after the condition increase in by 1
+ 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++;
}
}
}
}
+ 1
But task 4 wrong and closed
+ 1
Hope this helps you
+ 1
This task done !) thank you !)
+ 1
My pleasure
0
Just use this to do it if(number%3==0 || number%10==3)
0
I must get 3-13
0
Tell me about please “if(number%3==0 || number%10==3)”, i dont understand