Posts

Showing posts from September, 2019
# Factorial. ( function) DECLARE FUNCTION FACT(n) CLS INPUT " Enter any number ";n PRINT " factorial =";FACT(n) END FUNCTION FACT(n) F=1 FOR I=1 TO n F=F*I NEXT I FACT=F END FU
# Print natural no from 1 to 5.(sub) DECLARE SUB SERIES ( ) CLS CALL SERIES END SUB SERIES( ) FOR I =1 to 5 PRINT I NEXT I END SUB
# Display 1, 1, 2, 3, 5, 8 . . . . . . up-to ten terms.( sub) DECLARE SUB SERIES( ) CLS  CALL SERIES END SUB SERIES( ) A=1 B=1 FOR I =1 To 5 PRINT A A=A+B B=A+B NEXT I  END S
# Convert temperature in Celsius in Farenheit. ( function) DECLARE FUNCTION FARENHEIT(c) CLS INPUT " Enter Celsius ";c PRINT " Temperature in Fahrenheit ";FARENHEIT(c ) END FUNCTION FARENHEIT ( C) F=9*c/5+32 FARENHEIT=F END FUNCTION
# Sum of digits.(sub) DECLARE SUB SUM(n ) CLS INPUT "Enter any number";n CALL SUB (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 SUB
#  Area of 4 walls. ( 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) A=2*h*(l+b) AREA=A END FUNCTION
# Volume of cylinder. (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
#Area of circle. (sub) DECLARE SUB CIR(r) CLS INPUT"Enter radius";r CALL CIR(r) END SUB CIR(r) A=22/7*r^2 PRINT"Area of circle";A END
# Display 9,7,5,....  1(sub) DECLARE SUB SERIES() CLS INPUT"Enter any number ";n CALL SUB END SUB SERIES() FOR I= 9 To 1 Step -2 PRINT I NEXT I END SUB
# calculate distance travelled by body. (function) DECLARE FUNCTION DIS (u,t,a) CLS INPUT"Enter initial velocity";u INPUT"Enter Time";t INPUT"Enter Acceleration ";a PRINT" Distance travelled =";DIS(u,t,a) END FUNCTION DIS (u, t, a) S=u*t+1/2*a*t^2 DIS=S END FUNCTION
# Volume of box. (function) DECLARE FUNCTION VOL(l,b,h) CLS INPUT "Enter length ";l INPUT " Enter breadth ";b INPUT " Enter height ";h PRINT "Volume of a box =";VOL(l,b,h) END FUNCTION VOL(l,b,h) V=l*b*h VOL=V END FUNCTION
#  Print total no of vowels in a given word. (sub) 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$,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 no of vowels =";C END
# Area of a box. (function) DECLARE FUNCTION AREA (l,b,h) CLS INPUT " Enter length "; l INPUT " Enter breadth "; b INPUT " Enter height " ;h PRINT " Area 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
# To check whether the given no is completely divisible by 13 or not. (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 "the given no is divisible by 13" ELSE PRINT "the given no is not divisible by 13" END IF END SUB
# Circumference of circle. (sub) DECLARE SUB CIR (r) CLS INPUT " Enter Radius ";r CALL SUB END SUB CIR(r) C=2*22/7*r PRINT" Circumference of circle=";c END SUB
# Print simple interest. (Function) DECLARE FUNCTION SIMPLE(p,t,r) CLS INPUT "Enter principal";p INPUT "Enter time";t INPUT " Enter rate ";r PRINT "Simple interest ";SIMPLE(p,t,r) END FUNCTION SIMPLE (p,t,r) SI=(p*t*r)/100 SIMPLE=SI END FUNCTION
# Area of triangle. (function) DECLARE FUNCTION AREA (b, h) CLS INPUT " Enter breadth"; b INPUT " Enter height";h PRINT "Area of triangle =";AREA(b,h) END FUNCTION AREA(b,h) A=1/2*b*h AREA=A END FUNCTION
# Area of 4 walls. (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
#Average of 3 number. (function) DECLARE FUNCTION Av(a,b,c) CLS INPUT "Enter first number";a INPUT"Enter second number";b INPUT"Enter third number ";c PRINT"Average of 3 number";Av(a,,b, c) END FUNCTION Av(a,b,c) AvG=(a+ b+ c) /3 Av=AvG END FUNCTION