1 |
REM SUM OF EVEN NUMBERS IN FIRST 10 NATURAL NUMBERS
CLS
SUM = 0
FOR F = 1 TO 10 STEP 2
SUM = SUM + F
PRINT F, SUM
NEXT F
PRINT " SUM"; SUM
END |
2 |
REM REPEATED..ADDING - BETWEEN TWO STRINGS
CLS
A$ = "SUPER"
B$ = "-"
C$ = "COMPUTER"
D$ = A$ + B$ + C$
PRINT D$
END |
3 |
CLS
INPUT "ENTER ANY NUMBER="; N
FOR I = 1 TO 20
LET RES = N * I
PRINT N; "*"; I, "=", RES
NEXT I
END |
4 |
REM REPEATED..PRACTICE OF COMMANDS
CLS
A$ = "THE TORTOISE AND THE HAIR"
B$ = MID$(A$, 5, 3)
C$ = RIGHT$(A$, 4)
D$ = LEFT$(A$, 5)
E$ = MID$(A$, 10, 2)
F$ = MID$(A$, 14, 3)
G$ = E$ + F$
L = LEN(A$)
PRINT L
PRINT B$
PRINT C$
PRINT D$
PRINT E$
PRINT F$
PRINT G$
END |
5 |
REM CHECK THIS PROG
CLS
10 : INPUT "ENTER THE NO"; Q
15 : FOR I = 1 TO Q
16 : INPUT "ENTER THE FIRST NO "; E
20 : INPUT "ENTER THE SECOND NO"; W
30 : IF E > W THEN 40 ELSE 60
40 : PRINT "E >W"
50 : GOTO 70
60 : PRINT "E>Q"
65 : NEXT I
70 : END |
6 |
REM COMPARE TWO NUMBERS AND TELL WHICH IS BIGGER OR
SMALLER
CLS
10 : INPUT "ENTER THE NUMBER OF PAIRS TO BE COMPARED "; Q
15 : FOR I = 1 TO Q
16 : INPUT "ENTER THE FIRST NO "; E
20 : INPUT "ENTER THE SECOND NO"; W
30 : IF E > W THEN 40 ELSE 60
40 : PRINT "FIRST NO.E >SECOND NO. W"
50 : GOTO 70
60 : PRINT "FIRST NUMBER E=>SECOND NUMBER Q"
65 : NEXT I
70 : END |
7 |
REM WHILE-WEND USE (THE SAME WAS EXPLAINED WITH FOR..NEXT
ALSO)
REM INVERTED PYRAMID-DROPPING FROM RIGHT ONE BY ONE
CLS
LET Q$ = "PROGRAM"
LET W = LEN(Q$)
E = W
WHILE E > 0
LET R$ = LEFT$(Q$, E)
PRINT R$
E = E - 1
END |
8 |
REM INVERTED PYRAMID-DROPPING FROM LEFT ONE BY ONE
CLS
LET Q$ = "PROGRAM"
LET W = LEN(Q$)
E = W
WHILE E > 0
LET R$ = RIGHT$(Q$, E)
PRINT R$
E = E - 1
END |
9 |
REM ADDING ONE BY ONE FROM RIGHT- PYRAMID
CLS
LET Q$ = "PROGRAM"
LET W = LEN(Q$)
FOR I = 1 TO W
R$ = RIGHT$(Q$, I)
PRINT R$
NEXT
END |
10 |
REM ADDING ONE BY ONE FROM LEFT- PYRAMID
CLS
LET Q$ = "PROGRAM"
LET W = LEN(Q$)
FOR I = 1 TO W
R$ = LEFT$(Q$, I)
PRINT R$
NEXT
END |