9 Respuestas
+ 10
SARSIJ KUMAR ,
unformatted code always has a poor readability. searching for bugs is a nightmare.
this is how it could look like:
import java.util.Scanner;
public class Demo {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int number = sc.nextInt();
if (number >= 5) {
System.out.print(number);
}
}
}
+ 5
Write else statement
+ 5
SARSIJ KUMAR ,
it is your code, but written in more readable way. but you did it without the formatting.
+ 4
SARSIJ KUMAR ,
in the meantime you have modified your code. both of the codes run if we input numbers.
when you say *it didn’t run*,
> what did you input ?
> what output do you get ?
> what is the *expected* output ?
> and what issue do you have ?
> are there any error messages?
+ 3
Just clean your code it's so messy and I got it working from cleaning it up, just rewrite "Scanner sc = new Scanner(System.in); without adding any spaces it should be in one line of code
+ 1
How
+ 1
Thanks
0
But I think I wrote the same thing
0
But it didn't run