+ 1

Left Triangle Star Pattern Output Problem

I don't know why it's not working! Please someone help me.Here is my code. https://code.sololearn.com/c1s5Ci16iGz8/?ref=app

5th Oct 2021, 3:28 PM
Milon
Milon - avatar
13 Answers
+ 2
Coding Cat this is Right triangle
5th Oct 2021, 4:34 PM
Milon
Milon - avatar
+ 2
Jayakrishna🇮🇳 Result of my code
5th Oct 2021, 4:35 PM
Milon
Milon - avatar
+ 1
Time To Code I want to print left triangle. That's means left side space then something. And right side will be equal. if 1st row have 3 space then 2nd will be 2 space, 3rd will be 1 space and last one have no space.
5th Oct 2021, 4:30 PM
Milon
Milon - avatar
+ 1
Sorry, I know, it's solved. But I want to do that with only one single loop. And now I'm ready 😉 https://code.sololearn.com/cFxRQNs9H45F/?ref=app
5th Oct 2021, 8:10 PM
Coding Cat
Coding Cat - avatar
0
Its working... What is the you getting?
5th Oct 2021, 3:43 PM
Jayakrishna 🇮🇳
0
* * * * * * * * * * * * * * * Almost Like this. Jayakrishna🇮🇳
5th Oct 2021, 3:50 PM
Milon
Milon - avatar
0
Remove a space .. use this System.out.print("* "); //no space before it in line no: 17 edit: Milon if you don't want space at start, then comment System.out.print(" "); // in inner first loop.. for(int row=1; row<=n; row++){ // Number Printing for(int col=1; col<=row; col++){ System.out.print("* "); } //Printing New Line System.out.println(" "); }
5th Oct 2021, 3:52 PM
Jayakrishna 🇮🇳
0
Jayakrishna🇮🇳 output is now Pyramid🙃
5th Oct 2021, 3:55 PM
Milon
Milon - avatar
0
Now check my last post edit . edit: Remove first inner loop .. then try this : for(int row=1; row<=n; row++){ // Number Printing for(int col=1; col<=row; col++){ System.out.print("* "); } //Printing New Line System.out.println(" "); } edit: Milon the pattern you posted above is your expected one or the result of code?
5th Oct 2021, 3:59 PM
Jayakrishna 🇮🇳
0
Oh try this:Milon for(int row=1; row<=n; row++){ // Space printing for(int col=1; col<= n-row; col++){ System.out.print(" "); //double space } // Number Printing for(int col=1; col<=row; col++){ System.out.print(" *"); //no space after } //Printing New Line System.out.println(" "); }
5th Oct 2021, 4:38 PM
Jayakrishna 🇮🇳
0
Jayakrishna🇮🇳 Already try this. But didn't work. I'm coding with my phone. That's why i can't solve this. Thanka bro.
5th Oct 2021, 4:57 PM
Milon
Milon - avatar
0
I Solved it. Now it's working. Thanks Everyone.
5th Oct 2021, 5:17 PM
Milon
Milon - avatar