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
Category: Basic Programs, Computer Programs
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
Category: Basic Programs, Computer Programs
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
Category: Basic Programs, Computer Programs
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
Category: Basic Programs, Computer Programs
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
Category: Basic Programs, Computer Programs
REM REPEATED..ADDING – BETWEEN TWO STRINGS
CLS
A$ = “SUPER”
B$ = “-”
C$ = “COMPUTER”
D$ = A$ + B$ + C$
PRINT D$
END
Category: Basic Programs, Computer Programs
REM SUM OF EVEN NUMBERS IN FIRST 10 NATURAL NUMBERS
CLS
SUM = 0
FOR F = 10 TO 1 STEP -2
SUM = SUM + F
PRINT F, SUM
NEXT F
PRINT ” SUM”; SUM
END
Category: Basic Programs, Computer Programs
REM THE NAME IS INCORRCT. PROG GIVES SUM OF FIRST 10 ODD NUMBERS
CLS
SUM = 0
FOR I = 1 TO 10
LET X = 2 * I – 1
SUM = SUM + X
PRINT ” ODD NUMBER AT POSITION”; I; “IS”; X
NEXT I
PRINT “TOTAL SUM”, SUM
END
Category: Basic Programs, Computer Programs
REM SUM OF FIRST 100 NOS.
CLS
SUM = 0
FOR F = 1 TO 100
PRINT “NO. IS “; F
LET SUM = SUM + F
NEXT F
PRINT “SUM”; SUM
END
Category: Basic Programs, Computer Programs
REM TAKE A NUMBER, SQUARE IT
CLS
SUM = 0
FOR F = 1 TO 10
LET X = 2 * F – 1
LET D = X * X
SUM = SUM + D
PRINT F, X, D, SUM
NEXT F
PRINT
PRINT “SUM OF FIRST 10 EVEN SQUARES IS”, SUM
END
Category: Basic Programs, Computer Programs
Recent Comments