Category: Basic Programs

Basic Program To Find Maximum out of Given Numbers

REM FIND MAXIMUM OUT OF GIVEN NUMBERS
LET MAX = 1
INPUT “ENTER HOW MANY NOS.=”; N
FOR I = 1 TO N
INPUT “ENTER THE NUMBER”; NUMBER
IF NUMBER > MAX THEN MAX = NUMBER
NEXT I
PRINT MAX
END

Basic Program To Calculate Length of String,Go to left,Go to Length of String from there

REM CAL LENGTH OF STRING,GO TO LEFT,GO TO LENGTH OF STRING FROM THERE
REM AND THEN START REDUCING ONE BY ONE FROM LEFT
CLS
LET A$ = “RAJAT SHUKLA”
LET C = LEN(A$)
FOR D = C TO 1 STEP -1
LET C$ = LEFT$(A$, D)
PRINT C$
NEXT D
END

Basic Program To Print Length of the String

REM REPEATED PROG .. LENGTH OF GIVEN STRING
CLS
LET D$ = “RAJAT”
A = LEN(D$)
PRINT A
END

Basic Program To Take a String,Go Left,Count Number of Char to be Printed

REM REPEATED PROG TAKE A STRING,GO LEFT,COUNT NUMBER OF CHAR TO BE PRINTED
CLS
LET Q$ = “RAJAT”
LET W$ = LEFT$(Q$, 2)
PRINT W$
END

Basic Program To Take a String, Find Length, Go Left & Start

REM TAKE A STRING,FIND LENGTH,GO LEFT & START,FIRST>1,SECOND>2,….
CLS
INPUT “ANY STRING”; A$
LET B = LEN(A$)
FOR I = 1 TO B STEP 1
LET C$ = LEFT$(A$, I)
PRINT C$
NEXT I
END

Basic Program To Print Sum of Raise to Power Four Upto Number Specified

REM SUM OF RAISE TO POWER FOUR UPTO NUMBER SPECIFIED
REM SIMILARLY TRY SQ,CUBE,SIMPLE SUMS, SUM OF ODDS,EVENS IN FIRST Q
REM NATURAL NUMBERS..
CLS
INPUT “ENTER THE NUMBER “; Q
FOR I = 1 TO Q
SUM = 0
SUM = SUM + I ^ 2 * I ^ 2
PRINT SUM;
NEXT I
END

Basic Program To Plots a Histogram

REM THIS IS A PROJECT NOT IN COURSE
10 REM this program plots a histogram
20 REM the y-axis is horizontal and x-axis vertical
30 FOR I = 0 TO 40 STEP 10
40 PRINT TAB(I + 11); I;
48 NEXT I
50 PRINT TAB(11); “——————————————————”
60 PRINT
70 FOR I = 1 TO 4
80 READ N$, P
90 LET R = INT(P + .5)
100 FOR J = 1 TO 5
110 IF (J <> 3) THEN 130
120 PRINT TAB(4); N$;
130 FOR K = 1 TO R
140 PRINT TAB(10 + K); “*”;
150 NEXT K
160 PRINT
170 NEXT J
180 NEXT I
190 PRINT TAB(11); “—————————————————–”
200 PRINT
210 DATA “1951”,18.7,”1961″,22.4,”1971″,28.2,”1981″,35.6
220 END

Basic Program To Tell Length Of the String

REM REPEAT PROG ..TELLS LENGTH OF THE STRING
CLS
INPUT “ENTER ANY STRING”; A$
LET B = LEN(A$)
PRINT “THE STRING IS “; A$
PRINT “THE LENGTH IS”; B
END

Basic Program To Print first Odd Numbers

REM SUM OF FIRST ODD NUMBERS
FOR A = 1 TO 100
LET Z = 2 * A – 1
PRINT Z
NEXT A
END

Basic Program To add first 50 Even Numbers

REM SUM OF FIRST 50 EVEN NUMBERS
CLS
FOR A = 1 TO 50
LET Z = 2 * A
LET SUM = SUM + Z
NEXT A
PRINT “SUM”; SUM
END