+ 1
What is the code for this?
If the user enters a number (ex. 5) It will have an output of * ** *** **** *****
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 ^^