int x = 10 if (x > -1); if (x != 0); if (x > 0); System.out.println (“x is a positive number having value “ + x); | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

int x = 10 if (x > -1); if (x != 0); if (x > 0); System.out.println (“x is a positive number having value “ + x);

It produce error output😢... Sorryyy I'm a beginner and I wanted to learn coding but sad to say that was so hard for me😣

7th Dec 2020, 11:43 AM
Nadia Arias
Nadia Arias - avatar
2 Réponses
0
Error because if statement is a code block but you are putting semicolon after it. Try putting curly braces after your if statements {} but leave the semicolon after "int x = 10" hope this helps.
7th Dec 2020, 12:17 PM
pNK
pNK - avatar
+ 1
Please don't write your code in the title, if your code is short you can paste in Description, if it is big code, then save and share its link by following the below guide https://www.sololearn.com/post/75089/?ref=app
7th Dec 2020, 11:49 AM
Ipang