Please fix it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
9 Answers
+ 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); } } }
31st Mar 2023, 3:16 PM
Lothar
Lothar - avatar
+ 5
Write else statement
31st Mar 2023, 2:08 PM
Hasnain [ACTIVE CHALLENGER]
Hasnain [ACTIVE CHALLENGER] - avatar
+ 5
SARSIJ KUMAR , it is your code, but written in more readable way. but you did it without the formatting.
1st Apr 2023, 10:59 AM
Lothar
Lothar - avatar
+ 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?
3rd Apr 2023, 10:53 AM
Lothar
Lothar - avatar
+ 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
31st Mar 2023, 2:29 PM
Lily
Lily - avatar
+ 1
How
31st Mar 2023, 2:02 PM
SARSIJ KUMAR
SARSIJ KUMAR - avatar
+ 1
Thanks
1st Apr 2023, 6:02 AM
SARSIJ KUMAR
SARSIJ KUMAR - avatar
0
But I think I wrote the same thing
1st Apr 2023, 6:07 AM
SARSIJ KUMAR
SARSIJ KUMAR - avatar
0
But it didn't run
1st Apr 2023, 11:46 AM
SARSIJ KUMAR
SARSIJ KUMAR - avatar