<'&*&-+)*:'1&%('*",:+,'*• 4:'9)'*>"*&"B*-C$BDDE161-'#6,9>".9F%6916G$*• !:+1H*",*IJ'91-+,>K*• !:+1H*",*I44JK*:+,H*"5*IL6A*0'1&%('*233*/*7M*
0MM48K**%)'(+NB*E1>%')&O*$9))P"(NB*E1+>5Q*!"#$%&'()*+,*!-'#+)&(.*/*
0'1&%('*233*
4("56*7(6*8&'$-9,*3(:'*;%9,&%#*!-'#+)&(.*<("%$*=9>".9*?,+@'()+&.*A*

J"N9.R)*0'1&%('*Y6A*0""$*J.$')*• S'$'TT@'*'U'1%T",*V7"*&-'*)9#'*&-+,>*#9,.*
T#')W*• 0""$*&.$')*• !"%,&'(F!",&("::'N*7M*0""$)*• <','(9:*7M*0""$)*• 4('@+"%):.O*P'*:'9(,'N*9W*)'E%',1'*V('>%:9(*$(">(9#*)&9&'#',&)W*9,N*ZW*)':'1T",*V3[*)&9&'#',&)W*• ="P*P'*:'9(,*&-'*&-+(N*Z9)+1*1",&(":*)&(%1&%('O*,9#':.*
1W*('$'TT",*V('$'9&*&-'*)9#'*&-+,>*#9,.*T#')W6*• \*('$'TT",*)&(%1&%('*"(*:""$*#9H')*$"))+Z:'*&-'*('$'9&'N*'U'1%T",*"5*",'*"(*#"('*)&9&'#',&)O*19::'N*&-'*IZ"N.*"5*&-'*:""$K*• J-'('*9('*!"#$%&'()$!*+,'$#-$.,+,//#01$– S'$'TT",*1",&("::'N*%*$&$)#20!,.$V,%#'(+19:*@9(+9Z:'W*– S'$'TT",*1",&("::'N*%*$&$3#4()&3$,5+.,''(#0$X*

Y*

Y6]*!"%,&'(F!",&("::'N*7M*0""$)*3*

Y6]*!"%,&'(F!",&("::'N*7M*0""$)*33*• [MSJS\=*^_*$("@+N')*",'*Z9)+1*:""$*1",)&(%1&O*&-'*7M*1",)&(%1&6*• 7M*1",)&(%1&)*5"(*1"%,&'(F1",&("::'N*:""$)*-9@'*&-'*5"::"P+,>*5"(#B*• 67,0$!7,$3##+$('$,5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B**7M*l*`*AO*09)&sl*** *7M*=*`*AO*09)&s=*** * **4("N%1&*`*l*h*=*** * **4(+,&*hO*lO*I*IO*=O*I*IO*4("N%1&*** *b=7*7M**b=7*7M*• 7"P,:"9N*&-'*$(">(9#*#%:T$:+19T",F&9Z:'65^_O*1"#$+:'O*9,N*'U'1%&'*• M$',*qF&'(#+,9:O*1N*I7"P,:"9N)KO*9,N*
1"#$+:'B**1N*7"P,:"9N)*******$+1"*#%:T$:+19T",F&9Z:'65^_**>5"(&(9,*/"*#%:T$:+19T",F&9Z:'6U*#%:T$:+19T",F&9Z:'65^_*******6D#%:T$:+19T",F&9Z:'6U**AX*

Y6X*<','(9:*7M*0""$)*3*

AY*

Y6X*<','(9:*7M*0""$)*333*• !"%,&'(F1",&("::'N*7M*:""$)*'U'1%&'*&-'*)&9&'#',&)*+,*&-'*Z"N.*"5*&-'*:""$*5"(*9*$('FN'g,'N*,%#Z'(*"5*T#')6*• 8"#'T#')*P'*P+)-*&"*N'&'(#+,'*&-'*,%#Z'(*"5*('$'TT",)*7?S3=<*&-'*7M*:""$6*• ["(*&-+)O*P'*,''N*<b=bS\0*7M*:""$)*V7MFbq3J*1",)&(%1&)W*

Ae*

7M*

• [:"PF1-9(&B*)&9&'#',&)A*

6JS?b6*35*
3[*V:">+19:F'U$('))+",W*bq3J*6[\08b6*)&9&'#',&)]*

b=7*7M*Af*Y6X*<','(9:*7M*0""$)*32*

Y6X*<','(9:*7M*0""$)*2*• [MSJS\=*^_*5"(#*"5*7MFbq3J*1",)&(%1&B*• J"*)":@'*&-+)*$("Z:'#O*P'*#%)&*$'(5"(#*&-'*5"::"P+,>*)&'$)B*

7M**)&9&'#',&F)'E%',1'FA**3[*V:">+19:F'U$('))+",W*bq3J**)&9&'#',&F)'E%',1'F]*
b=7*7M*A6 b,&'(*&-'*@9:%'*5"(*0+#+&*]6 3,+T9:+a'*=%#Z'(*9,N*8%#*&"*_*
X6 S'$'9&*&-'*5"::"P+,>B*
96 35*8%#*u*0+#+&O*&'(#+,9&'*('$'TT",d*"&-'(P+)'*1",T,%'*P+&-*&-'*5"::"P+,>*Z6 3,1('#',&*=%#Z'(*Z.*A*
16 \NN*=%#Z'(*&"*8%#*• bU9#$:'B*1",)+N'(*$('@+"%)*'U9#$:'*
8%#*`*A*m*]*m*p*m*=%#Z'(*• ;%')T",B*["(*P-+1-*)#9::')&*=%#Z'(*+)*8%#*>('9&'(*&-9,*0+#+&t*

Y6 7+)$:9.*=%#Z'(*9,N*8%#*AL*

Y6X*<','(9:*7M*0""$)*23*

Ai*

Y6X*<','(9:*7M*0""$)*233*• J9)HB*r(+&'*."%(*"P,*[MSJS\=*1"N'*P+&-"%&*:""H+,>*g()&*9&*&-'*)":%T",O*)%#F&"F:+#+&65^_**• J-'*5"::"P+,>*+)*9,*+#$:'#',&9T",*"5*&-'*)":%T",*&"*&-+)*$("Z:'#B*
7M**3[*V8%#*u*0+#+&W*bq3J***Q*J'(#+,9&'*('$'TT",*****Q*M&-'(P+)'*1",T,%'*P+&-*&-'*5"::"P+,>****=%#Z'(*`*=%#Z'(*m*A****8%#*`*8%#*m*=%#Z'(*b=7*7M**<""N*:%1H6***

A^*]_*

7MF:""$*)":%T",*5"(*9))+>,#',&*333*
PROGRAM Do_Tree!
!-----------------------------------------------------------------------!
! Program to print the Christmas tree from Assignment III using a!
! Counter-controlled DO loop.!
! Variables: !
!
Maxlength: maximum number of columns in a line!
!
Line:
The line to be printed!
!
IStar:
Number of Stars (counter)!
!
IPos:
Position in line variable!
!
MaxStar:
How many Stars is maximum (limit)!
!
StarStep:
How many Stars more in each line!
!
(width of the tree, step-size)!
! Input: MaxStar!
! Output: Christmas tree!
!-----------------------------------------------------------------------!

7MF:""$*)":%T",*5"(*9))+>,#',&*333*! Initialize the line with blanks"!
DO IPos = 1, Maxlength!
Line(IPos:IPos) = " "!
END DO!
PRINT *,"*"!
DO IStar = 1, MaxStar-2, StarStep!
DO IPos = IStar, IStar+StarStep!
Line(IPos:IPos) = "*"!
END DO!
PRINT *, Line!
END DO!
END PROGRAM DO_Tree!

IMPLICIT NONE!
INTEGER, PARAMETER :: Maxlength = 72!
INTEGER :: IStar, MaxStar, StarStep, IPos!
CHARACTER*1 :: Star="*"!
CHARACTER*(Maxlength) :: Line!

RUNNING THE PROGRAM:!
[stephan@hawk trash]$ ./do-tree.x !
How many stars more in each line:!
2!
Maximum number of stars in a line:!
12!
*!
***
*****
*************************** !

PRINT *, "How many stars more in each line:"!
READ *, StarStep!
PRINT *, "Maximum number of stars in a line:"!
READ *, MaxStar!
! Check if MaxStar fits in the Line of length Maxlength!
IF (MaxStar > Maxlength) THEN!
PRINT *, "Maxstar", MaxStar, "is greater than", Maxlength!
STOP!
END IF!

]A*!
!
!
!

]]*