Posts

Showing posts from October, 2019
Program to find total no. of vowels in a given word using SUB DECLARE SUB DISPLAY(N$) CLS INPUT"ENTER ANY WORD";N$ CALL DISPLAY(N$) END SUB DISPLAY(N$) FOR I= 1 TO LEN(N$) B$= MID$(N$,I,1) C$= UCASE$(B$) IF C$="A" OR C$="E" OR C$="E" OR C$="I" OR C$="O" OR C$="U" THEN D$=D$+B$ NEXT I PRINT"VOWELS=";D$ END SUB
Program to find average of 3 numbers using FUNCTION DECLARE FUNCTION AVG(A,B,C) CLS INPUT"ENTER ANY THREE NUMBERS";A,B,C PRINT"Average of three numbers=";AVG(A,B,C) END FUNCTION AVG(A,B,C) AV=(A+B+C)/3 AVG=AV END FUNCTION
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 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 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
Program to find greatest among 3 numbers using SUB DECLARE SUB GREAT(A,B,C) CLS INPUT"ENTER FIRST NUMBER";A INPUT"ENTER SECOND NUMBER";B INPUT"ENTER THIRD NUMBER";C CALL GREAT(A,B,C) SUB SUB GREAT(A,B,C) IF A>B AND A>C THEN PRINT"GREATEST NUMBER IS";A ELSEIF B>A AND B>C THEN PRINT"GREATEST NUMBER IS";B ELSE PRINT"GREATEST NUMBER IS";C END IF END SUB
Program to find area of box using FUNCTION DECLARE FUNCTION AREA(L,B,H) CLS  INPUT"ENTER LENGTH";L INPUT"ENTER BREADTH";B INPUT"ENTER HEIGHT";H PRINT"AREA OF BOX=";AREA(L,B,H) END FUNCTION AREA(L,B,H) A=2*(L*B+B*H+L*H) AREA=A END FUNCTION
Program to find area if 4 walls using FUNCTION DECLARE FUNCTION AREA(L,B,H) CLS INPUT"ENTER LENGTH";L INPUT"ENTER BREADTH";B INPUT"ENTER HEIGHT";H AR=AREA PRINT"Area of 4 walls=";AREA(L,B,H) END FUNCTION AREA(L,B,H) AREA=2*H*(L+B) END FUNCTION
Program to find circumference of circle using SUB DECLARE SUB CIRCLE(R) CLS INPUT"ENTER RADIUS";R CALL CIRCLE(R) END SUB CIRCLE(R) C=2*22/7*R PRINT"CIRCUMFERENCE OF CIRCLE=";C END SUB
Program to find whether the given no. is divisible by 13 or not using SUB DECLARE SUB CHECK(N) CLS  INPUT"ENTER ANY NUMBER";N CALL CHECK(N) END SUB CHECK(N) IF N MOD 13=0 THEN  PRINT"DIVISIBLE BY 13" ELSE PRINT"NOT DIVISIBLE BY 13" END IF END SUB
Program to find volume of box using FUNCTION DECLARE FUNCTION VOL(L,B,H) CLS INPUT"ENTER LENGTH";L INPUT"ENTER BREADTH";B INPUT"ENTER HEIGHT";H PRINT"VOLUME OF BOX=";VOL(L,B,H) END FUNCTION VOL(L,B,H) V=L*B*H VOL=V END FUNCTION
Program to print only vowels from given word using SUB DECLARE SUB DISPLAY(N) CLS INPUT"ENTER ANY WORD";N$ CALL DISPLAY(N$) END SUB DISPLAY(N$) 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 D$=D$+B$ NEXT I PRINT"VOWELS="D$ END SUB
Program to check whether the given no is armstrong number or not using FUNCTION DECLARE FUNCTION ARM(N) CLS INPUT"ENTER ANY NUMBER";N A=P P=ARM IF A=P THEN PRINT"The given no is armstrong" ELSE PRINT"The given no is not armstrong" END IF END FUNCTION ARM(N) S=0 WHILE N<>0 R=N MOD 10 S=S+R^3 N=N\10 WEND ARM=S END FUNCTION
Program to calculate distance using FUNCTION DECLARE FUNCTION DISTANCE(A,U,T) CLS INPUT"ENTER ACCELERATION",A INPUT"ENTER INITIAL VELOCITY";U INPUT"ENTER TIME";T PRINT"DISTANCE TRAVELLED=";DISTANCE(A,U,T) END FUNCTION DISTANCE(A,U,T) S=U*T+1/2*A*T^2 DISTANCE=S END FUNCTION
Program to calculate distance using FUNCTION DECLARE FUNCTION DISTANCE(A,U,T) CLS INPUT"ENTER ACCELERATION",A INPUT"ENTER INITIAL VELOCITY";U INPUT"ENTER TIME";T PRINT"DISTANCE TRAVELLED=";DISTANCE(A,U,T) END FUNCTION DISTANCE(A,U,T) S=U*T+1/2*A*T^2 DISTANCE=S 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 check whether the given word is palindrome string or not using FUNCTION DECLARE FUNCTION PAL$(N$) CLS INPUT"ENTER ANY WORD";N$ P$=PAL$(N$) IF N$=P$ THEN PRINT"The given word is palindrome" ELSE PRINT"The given word is not palindrome" END FUNCTION PAL$(N$) FOR I= LEN$(N$) TO 1 STEP -1 B$= MID$(N$,I,1) C$=C$+B$ NEXT I PAL$=C$ END FUNCITON
Program to check whether the given no is armstrong number or not using FUNCTION DECLARE FUNCTION ARM(N) CLS INPUT"ENTER ANY NUMBER";N A=P P=ARM IF A=P THEN PRINT"The given no is armstrong" ELSE PRINT"The given no is not armstrong" END IF END FUNCTION ARM(N) S=0 WHILE N<>0 R=N MOD 10 S=S+R^3 N=N\10 WEND ARM=S END FUNCTION
Program to find the factors of a number using FUNCTION DECLARE FUNCTION FACT(N) CLS INPUT"ENTER ANY NUMBER";N PRINT"FACTOR=";FACT(N) END FUNCTION FACT(N) FOR I= 1 TO N IF N MOD I=0 THEN PRINT I NEXT I END FUNCTION