0
java program
I want (a-b c-d) but this gives me (a-b c-d-) public static void main(String[] args) { int x = 3; while (x > 0) { if (x > 2) { System.out.print("a"); } if (x == 2) { System.out.print("b c"); } if (x == 1) { System.out.print("d"); x = x - 1; } else System.out.print("-"); x = x - 1; } }
2 Réponses
+ 1
No, gives exactly (a-b c-d)
https://code.sololearn.com/cwEW3e3u51dx/?ref=app
+ 1
Coding Cat [Mouse searching] ooh yeah.. actually I was worried from morning because of else and now I'm seeing else actually I was written without else ...in my computer...idk how else is coming here...
anyway this program is running fine .. thank you