Posts

Showing posts from October, 2019

Positive or negative using sub

DECLARE SUB CHECK(N) INPUT"ENTER ANY NO";N CALL CHECK(N) END SUB CHECK(N) IF N>0 THEN PRINT"THE GIVEN NO IS POSITIVE" ELSEIF N<0 THEN PRINT"THE GIVEN NO IS NEGATIVE" END IF

Positive negative or neutral using sub

DECLARE  SUB VHECK(N) CLS INPUT"ENTER ANY NUMBER";N CALL CHECK(N) END SUB CHECK(N) IF N>0 THEN PRINT"THE GIVEN NO IS POSITIVE" ELSEIF N<0 THEN PRINT"THE GIVEN NO IS NEGATIVE" ELSE PRINT"THE GIVEN NO IS NEUTRAL" END IF ENS SUB

Factor using sub

DECLAFE SUB FACTOR(N) CLS INPUT"ENTER ANY NO";N CALL FACTOR(N) END SUB FACTOR(N) FOR I=1 TO N IF  N MOD I=0 THEN PRINT I NEXT I  END SUB

Factorial using function

DECLARE FUNCTION FACT(N) CLS INPUT"ENTER ANY NO";N PRINT"FACTORIAL=":FACT(N) END FUNCTION FACT(N) F=1 FOR I =1 TO N F=F*I NEXT I FACT=F END FUNCTION

Palindrome no of string

DECLARE SUB PAL(N$) CLS INPUT"ENTER ANY WORD";H$ CALL PAL(N$) END SUB PAL(N$) FOR I=LEN(N$) TO 1  STEP-1 B$=MID$(N$,I,1) C$=C$+B$ NEXT I IF N$=C$ THEN PRINT"THE GIVEN WORD IS PALINDROME" ELSE PRINT"THE GIVEN WORD IS NOT PALINDROME" END IF END SUB

Average of 3no(function)

DECLARE FUNCTION AVG(A,B,C) CLS INPUT"ENTER FIRST NO";A INPUT"ENTER SECOND NO";B INPUT"ENTER THIRDNO";C PRINT"AVERAGE OF THREE NO";AVG(A,B,C) END FUNCTION AVG(A,B,C) Av=(A+B+C)/3 AVG=AVE END FUNCTION

Print total no of vowel in a given word(sub)

DECLARE SUB DISP(N$) CLS INPUT"ENTER ANY WORD";N$ CALL DISP(N$) END SUB DISP(N$) FOR I=1 TO LEN(N$) B$=MID$(N$,I,1) C$=UCASE(B$) IFC$<>"A"ANDC$<>"E"ANDC$<>"I"ANDC$<>"O"AND C$<>"U"THEN U$=U+B$ NEXT IPRINT"VOWEL";V$ END SUB

Area of 4wall(sub)

DECLARE SUB AREA(L,B,H) CLS INPUT"ENTER LENGTH";L INPUT"ENTER BREADTH";B INPUT"ENTER HEIGHT";H END SUB AREA(L,B,H) A=2*H*(L+B) PRINT"AREA OF FOUR WALL";A END SUB

Count total no of vowel in a word(function)

DECLARE FUNCTION COUNT(N$) CLS INPUT"ENTER ANY WORDS";N$ PRINT"TOTAL NO OF VOWEL=";COUNT(N$) END FUNCTION COUNT(N$) C=0 FOR I=1TO LEN(N$) BS $=MID$(N$,I,1) C$=UCASE$(B$) IFC$="A"ORC$="E"ORC$="O"ORC$="U"THEN C=C+1 NEXT I COUNT=C END FUNCTION

DISPLAY REVERSE OF INPUT STRING(SUB)

DECLARE SUB REV(N$) CLS INPUT"ENTER ANY WORD";N$ CALL REV(N$) END SUB REV(N$) FOR I=LEN(N$) TO 1STEP -1 B$=MID$(N$,I,1) C$=C$+B$ NEXT I PRINT"REVERSED WORD I";C$ ENDSUB

Area of triangle (function)

DECLARE FUNCTION AREA(A,B,C) CLS INPUT"ENTER FIRST NO";A INPUT"ENTER SECOND NO";B INPUT"ENTER THIRD NO";C PRINT"AREA OF TRIANGLE";AREA(A,B,C) END FUNCTION AREA(A,B,C) AREA=(S*(S-A)*(S-B*(S-C)^(1/2) AREA=A ENS FUNCTION

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

Print first ten no using sub

DECLARE SUB SERIES () CLS CALL SERIES END SUB SERIES () A=1 FOR I=1 TO 10 PRINT"A A=A+2 NEXT I ENDSUB

Input string and count total no of constant (function)

DECLARE FUNCTION CONSO(N$) CLS INPUT"ENTER ANY WORD";N$ PRINT"TOTAL NO OF CONSONANT";CONSO(N$) END FUNCTION CONSO(N$) C=0 FOR I=1 TO LEN(N$) B$=MID$(N$,I,1) C$=UCASE$(B$) IF C$<>"A"ANDC$<>"E"ANDC$<>"I"ANDC$<>"C$<>"O"AND C$<>"U" THEN C=C+1 NEXT I CONSO=C END FUNCTION

Convert temperature in Celsius in farenheit using function

DECLARE FUNCTION CELSIUS(F) CLS INPUT"ENTER FARHRERHEIT";F PRINT"FAREHRENHEIT IN CELSIUS";CELSIUS (F) END FUNCTION CELCIUS(F) C=5*(9*(F-32)) CELCIUS=C END FUNCTION

Print natural no from 1to 5 using sub

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

Print simple interest using function

DECLARE FUNCTION SIM(P,T,R) CLS INPUT"ENTER PRINCIPAL";P INPUT"ENTER TIME";T INPUT"ENTER RATE";R PRINT"SIMPLE INTEREST";SIM(P,T,R) END FUNCTION SIM(P,T,R) S=P*T*R/100 SIM=S END FUNCTION

Greatest among three no using sub

DECLARE SUB GREAT(A,B,C) CLS INPUT"ENTER FIRST NO";A INPUT"ENTER SECOND NO";B INPUT"ENTER THIRDTHIRD NO";C CALL GREAT(A,B,C) END SUB GREAT(A,B,C) IF A>B AND A>C THEN PRINT"THE GREATEST NO IS";A ELSEIF B>C ANDB>A THEN PRINT"THE GREATEST NO IS";B ELSE PRINT"THE GREATEST NO IS";C END IF END FUNCTION

Display 1,1,2,3,5,8.......10item

DECLARE SUB SERIEA() 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

Area of 4wall using function

DECLARE FUNCTION AREA (L,B,H) CLS INPUT"ENTER LENGTH";L INPUT"ENTER BREADTH";B INPUT"ENRER HEIGHT";H PRINT"AREA OF 4WALL";AREA(L,B,H) END FUNCTION AREA(L,B,H) A=2*H*(L+B) AREA=A END FUNCTION

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"ARRA OF A BOX";AREA(L,B,H) END FUNCTION AREA(L,B,H) A=2*(L*H+B*H+L*B) AREA=A END FUNCTION

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) VOL=L*B*H VOL=V END FUNCTION

Print only vowel from a given word using sub

DECLARE SUB DISP(N$) CLS INPUT"ENTER ANY WORD";N$ CALL DISP(N$) END SUB DISP(N$) FOR I=1 TO LEN(N$) B$=MID$(N$,I,1) C$=UCASE$(B$) IF C$="A" OR C$="E"ORC$="I"ORC$="O"ORC$="U" THEN V$=V$+B$ NEXT I PRINT"VOWEL";V$ END SUB

Distance traveled by body

DECLARE FUNCTION DISTANCE(A,T,U) CLS INOUT"ENTER ACCELAERATION";A INPUT"ENTER TIME";T INPUT"ENTER INITIAL VELOCITY";U PRINT"DISTANCE TRAVALLED BY BODY";DISTANCR(A,T,U) END FUNCTION DISTANCE(A,T,U) S=U*T+1/2*A*T^2 DISTANCE=S END FUNCTION

Display 9,7,5,.....1using sub

DECLARE SUB SERIES() CLS CALL SERIES END SUB SERIES FOR I=9TO 1 PRINT I NEXT I END SUB

Armstrong no

DECLARE SUB A(N) CLS INPUT"ENTER ANY NO";N CALL A(N) END SUB A(N) S=0 A=N WHILE N<>0 R=N MOD 10 S=S+R^3 N=N\10 WEND IF A=S THEN PRINT"THE GIVEN NNO IS ARMSTRONG"; ELSE PRINT"THE GIVEN NO IS NOT ARMSTRONG" END IF END SUB

Palindrome no of string

DECLARE SUB PAL(N$) CLS INPUT"ENTER ANY WORD";H$ CALL PAL(N$) END SUB PAL(N$) FOR I=LEN(N$) TO 1  STEP-1 B$=MID$(N$,I,1) C$=C$+B$ NEXT I IF N$=C$ THEN PRINT"THE GIVEN WORD IS PALINDROME" ELSE PRINT"THE GIVEN WORD IS NOT PALINDROME" END IF END SUB

To check whether the given no is completely divisible by 13 or not using sub

DECLARE SUB CHECK (N) CLS INPUT"ENTER ANY NO";N CALL CHECK(N) END SUB CHECK(N) IF N MOD 13=0 THEN PRINT"THE GIVEN NO IS DIVISIBAL BY 13" ELSE PRINT"THE GIVEN NO IS NOT DIVIDIBAL BY 13" END IF END SUB

Positive or negative using sub

DECLARE SUB CHECK(N) INPUT"ENTER ANY NO";N CALL CHECK(N) END SUB CHECK(N) IF N>0 THEN PRINT"THE GIVEN NO IS POSITIVE" ELSEIF N<0 THEN PRINT"THE GIVEN NO IS NEGATIVE" END IF

Factorial using function

DECLARE FUNCTION FACT(N) CLS INPUT"ENTER ANY NO";N PRINT"FACTORIAL=":FACT(N) END FUNCTION FACT(N) F=1 FOR I =1 TO N F=F*I NEXT I FACT=F END FUNCTION

Factor using sub

DECLAFE SUB FACTOR(N) CLS INPUT"ENTER ANY NO";N CALL FACTOR(N) END SUB FACTOR(N) FOR I=1 TO N IF  N MOD I=0 THEN PRINT I NEXT I  END SUB

Positive negative or neutral using sub

DECLARE  SUB VHECK(N) CLS INPUT"ENTER ANY NUMBER";N CALL CHECK(N) END SUB CHECK(N) IF N>0 THEN PRINT"THE GIVEN NO IS POSITIVE" ELSEIF N<0 THEN PRINT"THE GIVEN NO IS NEGATIVE" ELSE PRINT"THE GIVEN NO IS NEUTRAL" END IF ENS SUB

DISPLAY 50,42,35,29,24...10ITEM

DECLARER SUB SERIES() CLS CALL SERIES END SUB SERIES() A=50 B=8 FOR I = 1 TO 10 PRINT A A=A-B B=B-1 NEXT I END

PERFECT SQUARE NO USING FUNCTION

DECLARE SUB SQU(N) CLS INPUT"ENTER ANY NO";N CALL SQU(N) END SUB SQU(N) S=SQU(N) IF S=INT(S)THEN PRINT"SUPPLIED NO IS PEFECT SQUARE" ELSE PRINT"SUPPLIED NO IS NO PERFECT SQUARE" END IF END SUB