Monday, October 21, 2019

Program to find area of circle using SUB

DECLARE SUB AREA(R)
CLS
INPUT"ENTER RADIUS";R
CALL AREA(R)
END

SUB AREA(R)
A= 22/7*R^2
PRINT"Area of circle=";A
END SUB

Program to find area of 4 walls using SUB

DECLARE SUB AREA(L,B,H)
CLS
INPUT"ENTER LENGTH":L
INPUT"ENTER BREADTH";B
INPUT"ENTER HEIGHT";H
CALL AREA(L,B,H)
END

SUB AREA(L,B,H)
A=2*H*(L+B)
PRINT"Area of 4 walls=";A
END SUB

Program to find total no. of vowels in a word using FUNCTION

DECLARE FUNCTION COUNT(N$)
CLS
INPUT"ENTER ANY WORD";N$
PRINT"Total no. of vowels=";COUNT(N$)
END

FUNCTION COUNT(N$)
C=0
FOR I= 1 TO LEN$(N$)
B$= MID$(N$,I,1)
C$=UCASE$(B$)
IF C$="A" OR C$="E" OR C$="I" OR C$="O" OR C$="U" THEN C=C+1
NEXT I
COUNT=C
END FUNCTION

Program to find reverse of input string using SUB

DECLARE SUB REV(N$)
CLS
INPUT"ENTER ANY WORD";N$
CALL REV(N$)
END

SUB REV(N$)
FOR I= LEN(N$) TO 1 STEP -1
B$=MID$(N$,I,1)
C$=C$+B$
NEXT I
PRINT"The reversed word=";C$
END SUB

Program to find area of triangle using FUNCTION

DECLARE FUNCTION AREA(A,B,C)
CLS
INPUT"ENTER FIRST SIDE";A
INPUT"ENTER SECOND SIDE";B
INPUT"ENTER THIRD SIDE";C
AR= AREA(A,B,C)
PRINT"Area of triangle="AR
END

FUNCTION AREA(A,B,C)
AREA=(S*(S-A)*(S-B)*(S-C))^(1/2)
END FUNCITON

Program to print volume of cylinder using FUNCTION

DECLARE FUNCTION VOL(R,H)
CLS
INPUT"ENTER RADIUS";R
INPUT"ENTER HEIGHT"H
PRINT"VOLUME OF CYLINDER="VOL(R,H)
END

FUNCTION VOL(R,H)
V=22/7*R^2*H
VOL=V
END FUNCTION

Program to print first 10 odd numbers using SUB

DECLARE SUB DISPLAY()
CLS 

CALL DISPLAY
END

SUB DISPLAY()
A=1
FOR I= 1 TO 10
PRINT A
NEXT I
END SUB

Program to convert temperature in into fahrenheit using FUNCTION

DECLARE FUNCTION CONVERT(C)
CLS 
INPUT"ENTER TEMPERATURE IN CELCIUS";C
PRINT"Temperature in fahrenheit=";CONVERT(C)
END

FUNCTION CONVERT(C)
F=9*C/5+32
CONVERT=C
END FUNCTION

Program to print simple interest using FUNCTION

DECLARE FUNCTION SIMPLE(P,T,R)
CLS
INPUT"ENTER PRINCIPLE";P
INPUT"ENTER TIME"T
INPUT"ENTER RATE";R
PRINT"Simple Interest=";SIMPLE(P,T,R)
END

FUNCTION SIMPLE(P,T,R)
S=(P*T*R)/100
SIMPLE=S
END FUNCTION

Program to print natural numbers from 1 to 15 using SUB

DECLARE SUB SERIES()
CLS
CALL SERIES
END

SUB SERIES()
FOR I=1 TO 5
PRINT I
NEXT I
END SUB

Program to display 1,1,2,3,5,8........upto 10th term using SUB

DECLARE SUB SERIES()
CLS
CALL SERIES()
END

SUB SERIES()
A=1
B=1
FOR I= 1 TO 5
PRINT A
PRINT B
A=A+B
B=A+B
NEXT I
END SUB

My journey of Jagat Mandir School

13 Years of ExperiencE It is also said that school is the next home of every child. "Failing and learning," Teachers are like...