DECLARE FUNCTION PERFECT (S)
CLS
INPUT "Enter any number"; N
S = SQR(N)
PR = PERFECT (S)
IF PR = S THEN
PRINT "PERFECT SQUARE"
ELSE
PRINT "NOT PERFECT SQUARE"
END IF
END
FUNCTION PERFECT (S)
PERFECT = INT (S)
END FUNCTION
DECLARE SUB CHECK(N)
CLS
INPUT "Enter any number.";N
CALL CHECK(N)
END
SUB CHECK(N)
IF N > 0 THEN
PRINT "The number is positive"
ELSEIF N < 0 THEN
PRINT"The number is negative"
ELSE
PRINT "The number is neutral"
END IF
END SUB
DECLARE FUNCTION ERA (A$)
CLS
INPUT "Enter any string";A$
PRINT "String without vowels =";ERA(A$)
END
FUNCTION ERA(A$)
FOR I = 1 TO LEN (A$)
B$ = MID$(A$,I,1)
C$ = UCASE$(B$)
IF C$ <> "A" AND C$ <> 'E" AND C$ <> "I" AND C$ <> "O" AND C$ <> "U" THEN D$ = D$ + C$
END IF
NEXT I
ERA = D$
END FUNCTION
DECLARE FUNCTION PAL$ ( N$ )
CLS
INPUT "Enter any number"; N$
P$ = PAL$ ( N$ )
IF N$ = P$ THEN
PRINT "The given word is Palindrome'
ELSE
PRINT " The given word is not Palindrome"
END IF
END
FUNCTION PAL$ (N$)
FOR I = LEN(S$) TO 1 STEP -1
B$ = MID$( N$, I, 1)
L$ = L$ + B$
NEXT I
PAL$ = L$
END FUNCTION
DECLARE SUB PRIME (N)
INPUT "Enter any number"; N
CALL PRIME (N)
END SUB PRIME (N)
C = 0
FOR I = 1 TO N
IF N MOD I = 0 THEN C = C + 1
NEXT I
IF C = 2 THEN
PRINT N; "IS PRIME NUMBER"
ELSE
PRINT N; "IS COMPOSITE NUMBER"
END IF
END SUB
DECLARE FUNCTION Factorial ( N ) CLS INPUT "Enter any number"; N PRINT "Factorial ="; Factorial ( N ) END FUNCTION Factorail ( N ) F = 1 F = F * I NEXT I Factorail = F END FUNCTION
DECLARE FUNCTION DISTANCE ( U, A, T ) CLS INPUT "Enter initial velocity"; U INPUT "Enter acceleration"; A INPUT "Enter time"; T PRINT " Distance travelled="; DISTANCE ( U, A, T ) END FUNCTION DISTANCE ( U, A, T ) DISTANCE = U 8 T + 1 / 2 * A * T ^ 2 END FUNCTION
DECLARE SUB DISPLAY ( N$ ) INPUT " Enter any number"; 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 "Vowel="; D$ END SUB
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 END FUNCTION
DECLARE FUNCTION Area ( L, B, H ) CLS INPUT "Enter length"; L INPUT "Enter breadth"; B INPUT "Enter height"; H PRINT "Area of 4 walls = "; Area ( L, B, H ) END FUNCTION Area ( L, B, H ) Area = 2 * H * ( L + B ) END FUNCTION
DECLARE FUNCTION Area ( L, B, H ) CLS INPUT "Enter length"; L INPUT "Enter breadtha"; B INPUT "Enter height"; H PRINT " Area of box"; Area ( L, B, H ) END FUNCTION Area ( L, B, H ) Area = 2 * ( L * H + B * H + L * B ) END FUNCTION
DECLARE SUB GREAT ( A, B, C ) CLS INPUT "Enter any three numbers"; A, B, C CALL GREAT ( A, B, C ) END SUB GREAT ( A, B, C ) IF A > B AND A > C THEN PRINT " The greatest number is A" ELSEIF B > A AND B > C THEN PRINT "the greatest number is B" ELSE PRINT "The greatest number is C" END IF END SUB
DECLARE FUNCTION SI ( P, T, R ) CLS INPUT "Enter principle"; P INPUT "Enter time"; T INPUT "Enter rate"; R PRINT "Simple Interest = "; SI ( P, T, R ) END
FUNCTION SI ( P, T, R ) SI = ( P* T* R ) / 100 END FUNCTION
DECLARE FUNCTION CEL ( C ) CLS INPUT "Enter celsius"; C PRINT "Temperature in celsius fahrenheit = "; CEL ( C ) END FUNCTION CEL ( C ) CEL = 9 * C / 5 + 32 END FUNCTION
DECLARE SUB SUM ( N ) CLS INPUT "Enter any number"; N CALL SUM ( N ) END SUB SUM ( N ) S = 0 WHILE N <> 0 R = N MOD 10 S = S + R N = N \ 10 WEND PRINT "Sum of digits="; S END SUM
DECLARE FUNCTION COUNT ( N$ ) CLS INPUT "Enter any word"; N$ PRINT "Total no. of constant = "; COUNT ( N$ ) END FUNCTION COUNT ( N$ ) C = 0 FOR I = 1 TO LEN ( N$ ) B$ = MID $ ( N$, I, 1 ) C$ = UCASE $ ( B$ ) IF C$ <> "I" AND C$ <> "O" AND C$ "U" THEN C = C + 1 NEXT I COUNT = C END 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 ) VOL = 22 / 7 * r ^ 2 * H END FUNCTION
DECLARE FUNCTION REV $ ( N$ ) CLS INPUT "Enter name"; N$ PRINT "Reverse string is"; REV$ ( N$ ) END FUNCTION REV$ ( N$ ) FOR I = LEN ( N$ ) TO 1 STEP -1 B$ = MID $ ( N$, I, 1) C$ = C$ + B$ NEXT I REV$ = C$ END FUNCTION
DECLARE FUNCTION COUNT ( N$ ) CLS INPUT "Enter any word"; N$ PRINT " Total number of word ="; COUNT ( N$ ) END FUNCTION COUNT ( N$ ) C = 0 FOR I = 1 TO LEN ( N$) B$ = MID $ ( N$, I, 1 ) C$ = UCASE $ ( B$ ) C = C + 1 NEXT I COUNT = C END FUNCTION
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 four walls="; A END
DECLARE FUNCTION COUNT ( N$ ) CLS INPUT "Enter any word"; N$ PRINT "Total number 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
DECLARE SUB COUNT ( N$ ) CLS INPUT " Enter any word"; N$ CALL COUNT ( N$ ) END SUB 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 PRINT " TOTAL NUMBER OF VOWELS="; C$ END SUB
DECLARE FUNCTION AVG ( A, B, C) CLS INPUT " Enter any three number"; A, B, C PRINT " Average of three number"; AVG ( A, B, C) END FUNCTION AVG ( A, B, C) AV = ( A + B + C ) / 3 AVG = AV END FUNCTION