+ 1

What is the code for this?

If the user enters a number (ex. 5) It will have an output of * ** *** **** *****

30th Sep 2017, 7:11 AM
Jan Paul Echaveria
Jan Paul Echaveria - avatar
2 Answers
+ 13
int n = 5; for(int i = 1; i <= n; i++) { for(int j = 1; j <= i; j++) { System.out.print("*"); } System.out.println(); } // You can take the input (as n) as per your choice ^^
30th Sep 2017, 7:22 AM
Dev
Dev - avatar