program to produce these outputs

I need a program that will produce these outputs

enter number of rows 4

*
**
***
****
(This set of astericks comes out just this way)


enter number of rows 4
*
***
*****
*******

(This set of astericks are indented and form a shape resembling a Christmas tree).
kazooie21Asked:
Who is Participating?
 
Alisher_NConnect With a Mentor Commented:
Program Chr_Tree;
var
   Max, J1, J2, J3 : Ineteger;
begin
   Write( 'Enter number of rows: ' );
   Readln( Max );
   for J1 := 1 to Max do begin
     J2 := J1 * 2 - 1;
     for J3 := 1 to J2 do Write( '*');
     Writeln;
   end; {for}
end.

0
All Courses

From novice to tech pro — start learning today.