1 |
CLS
A$ = "RAMAN"
B$ = "NARAYANAN"
C$ = "MAN"
D$ = LEFT$(A$, 3)
E$ = MID$(B$, 4, 4)
F$ = MID$(C$, 2, 2)
G$ = D$ + E$ + F$
PRINT G$
END |
2 |
CLS
A$ = "RAMAN"
B$ = "NARAYANAN"
C$ = "MAN"
D$ = LEFT$(A$, 3)
E$ = MID$(B$, 4, 4)
F$ = MID$(C$, 2, 2)
G$ = D$ + E$ + F$
PRINT G$
REM FOLLOWING STEPS ARE TO EXPLAIN THE COMMANDS
PRINT A$, "LEFT 3"
PRINT B$, "MID 4 4"
PRINT C$, "MID 2 2"
END |
3 |
REM SUM OF FIRST 100 ODD NUMBERS
CLS
SUM = 0
FOR F = 1 TO 100
LET SUM = SUM + 2 * F - 1
NEXT F
PRINT SUM
END |
4 |
REM REPEATED PROG
CLS
LET Q$ = "RAJAT"
LET W$ = RIGHT$(Q$, 2)
PRINT W$
END |
5 |
REM INSERT SPACE BETWEEN TWO STRINGS
CLS
INPUT " ENTER ANY STRING"; A$
V$ = LEFT$(A$, 11)
C$ = " "
D$ = RIGHT$(A$, 13)
F$ = V$ + C$ + D$
PRINT F$
END |
6 |
REM MODIFYING A STRING
CLS
P$ = "PROGRAMMING IN BASIC IS INTERESTING"
V$ = LEFT$(P$, 11)
C$ = " "
D$ = RIGHT$(P$, 14)
F$ = V$ + C$ + D$
PRINT F$
END |
7 |
CLS
FOR I = 100 TO 1 STEP -1
FOR J = 100 TO I
PRINT J
NEXT J
PRINT
NEXTI
END
PRINT I;
SUM = SUM + 1
NEXT I
PRINT SUM
END |
8 |
CLS
FOR I = 1 TO 5
FOR j = 1 TO I
PRINT "*";
NEXT j
PRINT
NEXT I
FOR I = 4 TO 1 STEP -1
FOR j = 1 TO I
PRINT "*";
NEXT j
PRINT
NEXT I
END |
9 |
CLS
SCREEN 1
FOR I = 1 TO 150
CIRCLE (100 + I, 100), 56
CIRCLE (100 + I, 100), 50
NEXT I
PRINT " RUPAL is best CHILLA"
END |
10 |
REM SUM OF ODD NOS.
CLS
SUM = 0
FOR I = 1 TO 100
LET A = 2 * I - 1
LET SUM = SUM + A
REM CHECK WHY THIS PROG WAS NAMED SQUAODD?
NEXT I
PRINT " SUM"; SUM
END |
11 |
REM SUM OF FIRST N ODD NOS., SUM OF SQU OF FIRST N ODD
NOS..?
CLS
SUM = 0
FOR I = 1 TO 10
LET A = 2 * I - 1
LET A = A * A
LET SUM = SUM + A
PRINT A, SUM
NEXT I
PRINT " SUM"; SUM
END |
12 |
REM THIS IS SQUARE OF ODDS NOT EVEN
CLS
SUM = 0
FOR F = 1 TO 100
LET X = 2 * F - 1
LET D = X * X
PRINT D;
NEXT F
END |
13 |
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 |
14 |
FOR I = 1 TO 5
FOR J = 1 TO I
PRINT "*";
NEXT J
PRINT
NEXT I
FOR I = 4 TO 1 STEP -1
FOR J = 1 TO I
PRINT "*";
NEXT J
PRINT
NEXT I
END |
15 |
REM MODIFYING STRING
CLS
C$ = "STAND OPPOSITE TO HIM"
D$ = LEFT$(C$, 2)
E$ = MID$(C$, 7, 2)
F$ = RIGHT$(C$, 4)
G$ = D$ + E$ + F$
PRINT G$
END |
16 |
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 |
17 |
REM REPEATED
CLS
SUM = 0
FOR F = 1 TO 100
PRINT F
SUM = SUM + F
NEXT F
PRINT "THE SUM"; SUM
END |
18 |
REM REPEATED..EXPERIMENTING WITH COMMANDS
CLS
LET Q$ = "SUMAN IS A NICE GIRL"
PRINT LEFT$(Q$, 5)
PRINT LEFT$(Q$, 10)
PRINT RIGHT$(Q$, 4)
PRINT RIGHT$(Q$, 9)
PRINT MID$(Q$, 12, 4)
END |
19 |
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 |
20 |
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 |