Question: StringBuilder line = new StringBuilder ( ) ; / / outer loop runs from 1 to n for ( int row = 1 ; row
StringBuilder line new StringBuilder;
outer loop runs from to n
for int row ; row n; row
inner loop runs from to n
for int col ; col n; col
if the column value is greater than or equal to row
append an asterisks
if col row line.append;
else append a dash
else line.append;
if row is not equal to n then append a newline character
if row n
line.append
;
convert the object to string and return
return line.toString;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
