Slove this problem(triangle) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
23rd Nov 2018, 7:03 AM
Rameshwar Shivshette
Rameshwar Shivshette - avatar
5 Answers
+ 13
Rishi Anand Sir I think 1st inner loop is purposely created for making spaces at beginning of each line only !!!$coding Except$!!! can clear what to solve in this //looks like advertisement post to me 😅
23rd Nov 2018, 7:29 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 9
Hy !!!$coding Except$!!! ☺ Have a look at Sololearn guidelines to use q/a section effectively , it looks like an advertisement post [NOT a question] https://www.sololearn.com/Discuss/1316935/?ref=app
23rd Nov 2018, 7:13 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 1
Assuming that you want the pattern like * *** ***** ******* ********* *********** ************* *************** //here's the code snippet int count=0; for(int i=1;I<=8;i++) { for(int j=1;j<=i+count;j++) { System.out.prinr("*"); } ++count; System.out.println(); }
23rd Nov 2018, 7:28 AM
Rishi Anand
Rishi Anand - avatar
+ 1
Gaurav Agrawal I think your are right but if he could post the pattern then the picture will be more clear
23rd Nov 2018, 7:34 AM
Rishi Anand
Rishi Anand - avatar
0
I modified this one.. check it out once.. public class Program { public static void main(String[] args) { int n=10; for(int i=1;i<10;i++) { for(int j=1;j<n;j++) { System.out.print(" "); } n--; for(int k=1;k<=i;k++) { System.out.print("* "); } System.out.print("\n"); } } }
10th Apr 2019, 6:18 AM
Syntax_error_chaitu
Syntax_error_chaitu - avatar