1 |
10 CLS
20 REM TO STORE AND PRINT FIRST N EVEN NUMBERS
30 INPUT "ENTER HOW MANY NUMBERS"; N
40 DIM A(N)
50 FOR I = 1 TO N
60 LET A(I) = 2 * I
70 NEXT I
80 CLS
90 FOR I = 1 TO N
100 PRINT A(I)
110 NEXT I
120 END |
2 |
10 CLS
20 REM TO STORE AND PRINT FIRST N ODD NUMBERS
30 INPUT "ENTER HOW MANY NUMBERS"; N
40 DIM A(N)
50 FOR I = 1 TO N
60 LET A(I) = 2 * I - 1
70 NEXT I
80 CLS
90 FOR I = 1 TO N
100 PRINT A(I)
110 NEXT I
120 END |
3 |
10 CLS
20 REM TO STORE AND PRINT FIRST N ODD NUMBERS
30 INPUT "ENTER HOW MANY NUMBERS"; N
40 DIM A(N)
50 FOR I = 1 TO N
60 LET A(I) = 2 * I - 1
70 NEXT I
80 CLS
90 FOR I = 1 TO N
100 PRINT A(I)
110 NEXT I
120 END |
4 |
10 CLS
20 REM TO STORE AND PRINT 10 NUM
30 DIM A(10)
40 FOR I = 1 TO 10
50 INPUT "ENTER THE NUMBER"; A(I)
60 NEXT I
70 CLS
80 FOR I = 1 TO 10
90 PRINT A(I)
100 NEXT I
110 END
|
5 |
REM THIS PROG ADDS TWO IN SERIES AND PUTS AS NEXT IN
SERIES
REM This Prog is not correct N2=1 and put step nos (see N3prog)
CLS
INPUT "ENTER THE VALVUE "; N
N1 = 0
N2 = 0
PRINT N1; N2
FOR I = 1 TO N
N3 = N1 + N2
PRINT N3
N1 = N2
N2 = N3
NEXT I
END |
6 |
CLS
INPUT "YOUR FIRST NAME ?"; A$
INPUT "YOUR MIDDLE NAME ?"; B$
INPUT "YOUR SURNAME ?"; C$
D$ = LEFT$(A$, 1) + "."
E$ = LEFT$(B$, 1) + "."
F$ = D$ + E$ + C$
PRINT "YOUR SHORT NAME IS "; F
END |
7 |
REM CALCULATE AND TELL AREA AND PERIMETER
INPUT "ENTER LENGTH="; L
INPUT "ENTER BREADTH="; B
PRINT " MENU "
PRINT " 1. AREA OF RECTANGLE "
PRINT " 2. PERIMETER OF RECTANGLE "
INPUT "ENTER YOUR CHOICE"; CHOICE
IF CHOICE = 1 THEN GOTO 10 ELSE GOTO 20
10 LET AREA = L * B
PRINT AREA: END
20 LET PERI = 2 * (L + B)
PRINT PERI
END |
8 |
INPUT "Avwerage of how many numbers ? enter any
number "; N
FOR I = 1 TO N
INPUT "ENTER THE NUMBER "; NUM
LET SUM = SUM + NUM
NEXT I
LET AVG = SUM / N
PRINT "AVERAGE"; AVG
END
REM INTERESTING...IF U DO NOT GIVE ANY NUMBER |
9 |
CLS
11 LET A$ = "BANANA"
REM YOU CAN USE INPUT "ENTER A WORD";A$ ALSO
12 L = LEN(A$)
22 GOSUB 100
44 END
100 FOR I = L TO 1 STEP -1
120 Q$ = MID$(A$, I, 1)
REM THIS COMMAND TELLS JUMP IN MIDDLE POSITION INDICATED BY I
REM AND FROM THERE COUNT 1 ie NUMBER ITSELF
121 PRINT Q$;
122 REM NOTICE ; AFTER Q$ IT IS IMPORTANT
125 NEXT I
130 RETURN |
10 |
CLS
11 LET A$ = "BANANA"
12 L = LEN(A$)
22 GOSUB 100
44 END
100 FOR I = L TO 1 STEP -1
120 Q$ = MID$(A$, I, 1)
121 PRINT Q$;
125 NEXT I
130 RETURN |
11 |
REM IT IS A PROJECT NOT IN COURSE ?
CLEAR
LET HATHIPOLE = 0
LET CHETAK = 0
LET MOTIMAGRI = 0
PRINT "WHERE TO GET DOWN", "NUMBER OF STUDENTS"
INPUT "NUMBER OF STUDENTS"; S
FOR I = 1 TO S
READ D
IF D < 5 THEN HATHIPOLE = HATHIPOLE + 1 ELSE IF (D >= 5 AND D < 10) THEN CHETAK =
CHETAK + 1 ELSE MOTIMAGRI = MOTIMAGRI + 1
NEXT I
PRINT " HATHIPOLE", HATHIPOLE
PRINT
PRINT " CHETAK", CHETAK
PRINT
PRINT " MOTIMAGRI", MOTIMAGRI
PRINT
DATA 15,11,3.5,34,4,12,13,6.5,12,13,14
END
CLEAR |
12 |
CLEAR
LET HATHIPOLE = 0
LET CHETAK = 0
LET MOTIMAGRI = 0
LET S = 0
PRINT "WHERE TO GET DOWN", "NUMBER OF STUDENTS"
INPUT "NUMBER OF STUDENTS"; S
FOR I = 1 TO S
INPUT "km"; D
IF D < 5 THEN HATHIPOLE = HATHIPOLE + 1 ELSE IF (D >= 1 AND D < 2) THEN CHETAK =
CHETAK + 1 ELSE MOTIMAGRI = MOTIMAGRI + 1
NEXT I
PRINT " HATHIPOLE", HATHIPOLE
PRINT
PRINT " CHETAK", CHETAK
PRINT
PRINT " MOTIMAGRI", MOTIMAGRI
PRINT
DATA LEN(S)
REM THIS CORRECTION WAS DONE ON MARCH 21, 1999
END
CLEAR |
13 |
REM NOTE HOW GOSUB TAKES TO A DIFF PROGRAMME AND RETURN
BRINGS IT BACK
CLS
10 INPUT "ENTER ANY NUM"; A
20 INPUT "ENTER ANY NUM"; B
30 INPUT "ENTER ANY VALUE "; C
40 GOSUB 100
50 PRINT "C1:SUM OF THREE NUMBERS IS"; C1
60 PRINT "C2:SUM OF THE SQUARES OF THREE NUMBERS IS "; C2
70 PRINT "C3:SUM OF THE CUBES OF THREE NUMBERS"; C3
80 END
100 LET C1 = A + B + C
110 LET C2 = A ^ 2 + B ^ 2 + C ^ 2
120 LET C3 = A ^ 3 + B ^ 3 + C ^ 3
130 RETURN |
14 |
REM TAKE INPUTS AND ADD THEM AND PRINT THEM
CLS
INPUT "ENTER NO OF STUDENT "; Q
FOR I = 1 TO Q
INPUT "ENTER STUDENT NAME"; W$
INPUT "ENTER COST OF FOOD"; F
INPUT "ENTER COST OF ACCOMADITION"; A
INPUT "ENTER COST OF TRAVELLING"; T
E = F + A + T
PRINT "FOOD...."; F
PRINT "ACOMADITION...."; A
PRINT "TRAVELLING...."; T
PRINT "TOTAL...."; E
NEXT I
END |
15 |
REM THIS PROGRAMM NEEDS IMPROVEMENT
CLS
10 A$ = "TOKYO"
20 INPUT "WHAT IS CAPITAL OF JAPAN ?"; B$
30 IF A$ = B$ THEN 40 ELSE 60
40 PRINT "GOOD"
41 GOTO 80
60 PRINT "WRONG- IT IS "; A$
70 C$ = "COLUMBO"
80 INPUT "THE COUNTRY IS SRILANKA"; D$
90 IF C$ = D$ THEN 100 ELSE 130
100 PRINT "GOOD"
110 GOTO 150
130 PRINT "WRONG"
140 E$ = "DELHI"
150 INPUT "THE COUNTRY IS INDIA"; F$
160 IF E$ = F$ THEN 170 ELSE 190
170 PRINT "GOOD"
175 GOTO 210
190 PRINT "BAD"
200 G$ = "DHAKA"
210 INPUT " THE COUNTRY IS BANGLADESH"; H$
220 IF G$ = H$ THEN 230 ELSE 250
230 PRINT "GOOD"
250 PRINT "WRONG"
270 I$ = "TYU"
280 INPUT "THE COUNTRY IS QUATE"; Z$
290 IF I$ = Z$ THEN 300 ELSE 320
300 PRINT "GOOD"
320 PRINT "WRONG"
330 END |
16 |
REM CORRECTED PROGRAMME
CLS
10 A$ = "TOKYO"
20 INPUT "THE COUNTRY IS JAPAN"; B$
30 IF A$ = B$ THEN 40 ELSE 60
40 PRINT "GOOD"
50 GOTO 70
60 PRINT "WRONG"
70 C$ = " COLUMBO"
80 INPUT "THE COUNTRY IS SRILANKA"; D$
90 IF C$ = D$ THEN 100 ELSE 130
100 PRINT "GOOD"
120 GOTO 140
130 PRINT "WRONG"
140 E$ = " DELHI"
150 INPUT "THE COUNTRY IS INDIA"; F$
160 IF E$ = F$ THEN 170 ELSE 190
170 PRINT "GOOD"
180 GOTO 200
190 PRINT "WRONG"
200 G$ = " DHAKA"
210 INPUT " THE COUNTRY IS BANGLADESH"; H$
220 IF G$ = H$ THEN 230 ELSE 250
230 PRINT "GOOD"
240 GOTO 270
250 PRINT "WRONG"
270 I$ = " TYU "
280 INPUT "THE COUNTRY IS KWAIT"; Z$
290 IF I$ = Z$ THEN 300 ELSE 320
300 PRINT "GOOD"
310 GOTO 330
320 PRINT "WRONG"
330 END |
17 |
REM THIS PROGRAMME TELLS HOW MANY TIMES A CHAR REPEATS IN
A STRING
CLS
COUNT = 0
INPUT "ENTER ANY STRING"; N$
INPUT "ENTER ANY CHARACTER"; A$
L = LEN(N$)
FOR T = 1 TO L
LET S$ = MID$(N$, T, 1)
IF S$ = A$ THEN COUNT = COUNT + 1
NEXT T
PRINT "TOTAL NO OF OCCURENCE OF "; A$; " IS"; COUNT; "times"
END |
18 |
REM NOT IN COURSE
CLS
SCREEN 2
FOR I = 1 TO 15
CIRCLE (10 + I, 100), 100
CIRCLE (10 + I, 100), 100
NEXT I
END |
19 |
CLS
FOR I = 1 TO 5
FOR J = 1 TO I
PRINT I
NEXT J
PRINT
NEXT I
END |
20 |
REM MORE YOU SELL, MORE DISCOUNT YOU GET. KEEP DIS AMT AND
PAY balance.
INPUT "SALE="; SALE
IF SALE < 10000 THEN DIS = 5 / 100
IF SALE >= 10000 AND SALE <= 25000 THEN DIS = 10 / 100
IF SALE > 25000 THEN DIS = 15 / 100
LET DISAMT = DIS * SALE
LET NAMT = SALE - DISAMT
PRINT "DISCOUNT GIVEN"; DISAMT
PRINT "AMOUNT PAID"; NAMT
END |