Friday, August 21, 2015

28. Computer Programming with flowcharting Technique (page 28)



7.3. Looping in the loop
Problem example
Print number 2 to 10 step 3, every number printed followed by article * counted number is printed by that. The process is repeated 4 times
Output :
2 * * 5 * * * * * 8 * * * * * * * *
2 * * 5 * * * * * 8 * * * * * * * *
2 * * 5 * * * * * 8 * * * * * * * *
2 * * 5 * * * * * 8 * * * * * * * *


Program Listing
10 CLS
15 PRINT “PROG038”
20 A$ = “*” : K = 0 : B = 0 : C = 0
30 C = C + 1
40 IF C > 4 THEN 160
50 K = - 1
60 K = K + 3
70 IF K > 10 THEN 140
80 PRINT K ;
90 B = 0
100 B = B + 1
110 IF B > K THEN 60
120 PRINT A$;
130 GOTO 100
140 PRINT
150 GOTO 30
160 END

Description:
Statement PRINT at line 70 is that line move display.

Followers

Blog Archive