SUB PROCEDURE AND FUNCTION PROCEDURE IN USE

* WAP to find the volume of cylinder and hemisphere.

> DECLARE SUB CYL(R, H)
   DECLARE SUB HEMI (R)
   CLS
   INPUT "ENTER RADIUS"; R
   INPUT "ENTER HEIGHT OF CYLINDER"; H
   CALL CYL(R, H)
   CALL HEMI(R)
   END

   SUB CYL(R, H)
   VOL1 = 22/7*R^2*H
   PRINT " VOLUME OF CYLINDER = " VOL1
   END SUB

   SUB HEMI(R)
   VOL2 = 2/3*22/7*R^3
   PRINT "VOLUME OF HEMISPHERE = "; VOL2
   END SUB

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

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

   FUNCTION HEMI(R)
   HEMI = 2/3*22/7*R^3
   END FUNCTION

* WAP to convert Nepali currency into US dollar.

> DECLARE SUB USD(NC)
   CLS
   INPUT "ENTER NEPALI CURRENCY VALUE"; NC
   CALL USD (NC)
   END

   SUB USD(NC)
   D = NC / 109
   PRINT " AMERICAN DOLLAR VALUE ="; D
   END SUB

> DECLARE FUNCTION USD ( NC)
   CLS
   INPUT "ENTER NEPALI CURRENCY VALUE" ; NC
   PRINT "AMERICAN DOLLAR VALUE = "; USD(NC)
   END

   FUNCTION USD(NC)
   USD = NC/109
   END FUNCTION

* WAP to find area of sphere.

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

   SUB AREA(R)
   A = 4*22/7*R^2
   PRINT "AREA OF SPHERE = "; A
   END

> DECLARE FUNCTION AREA (R)
   CLS
   INPUT "ENTER RADIUS"; R
   PRINT "AREA OF SPHERE = "; AREA(R)
   END

   FUNCTION AREA (R)
   AREA = 4*22/7*R^2
   END

* WAP to convert USD into Nepali currency.

> DECLARE SUB NC(USD)
   CLS
   INPUT "ENTER AMERICAN DOLLAR VALUE"; USD
   CALL NC(USD)
   END

   SUB NC(USD)
   N = USD * 109
   PRINT "NEPALI CURRENCY VALUE ="; N
   END SUB

> DECLARE FUNCTION NC(USD)
   CLS
   INPUT "ENTER AMERICAN DOLLAR VALUE"; USD
   PRINT "NEPALI CURRENCY VALUE = "; NC(USD)
   END

   FUNCTION NC(USD)
   NC = USD * 109
   END FUNCTION

* WAP to calculate area and volume of a box.

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

   SUB AREA (L,B,H)
   A = 2*(L*B+B*H+L*H)
   PRINT "AREA OF BOX = "; A
   END SUB

   SUB VOLUME (L,B,H)
   V=L*B*H
   PRINT "VOLUME OF BOX= " ; V
   END

> DECLARE FUNCTION AREA (L,B,H)
   DECLARE FUNCTION VOLUME (L,B,H)
   CLS
   INPUT "ENTER LENGTH"; L
   INPUT "ENTER BREADTH"; B
   INPUT "ENTER HEIGHT"; H
   PRINT "AREA OF BOX= ";AREA (L,B,H)
   PRINT "VOLUME OF BOX= "; VOLUME(L,B,H)
   END

   FUNCTION AREA(L,B,H)
   AREA = 2*(L*B+B*H+L*H)
   END FUNCTION
  
   FUNCTION VOLUME(L,B,H)
   VOLUME =L*B*H
   END FUNCTION

* WAP to calculate Total surface Area of sphere.

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

   SUB TSA(R)
   A=2*22/7*R^2
   PRINT "TOTAL SURFACE AREA OF SPHERE = ";A
   END SUB

> DECLARE FUNCTION TSA(R)
   CLS
   INPUT "ENTER RADIUS";R
   PRINT "TOTAL SURFACE AREA OF SPHERE= ";TSA(R)
   END

   FUNCTION TSA(R)
   TSA =3*22/7*R^2
   END FUNCTION

* WAP to convert Nepali currency into Indian currency.

> DCLARE SUB IC(NC)
   CLS
   INPUT "ENTER NEPALI CURRENCY VALUE"; NC
   CALL IC(NC)
   END

   SUB IC(NC)
   I = NC/1.6
   PRINT "INDIAN CURRENCY VALUE = ";I
   END SUB

> DECLARE FUNCTION IC(NC)
   CLS
   INPUT "ENTER NEPALI CURRENCY VALUE"; NC
   PRINT "INDIAN CURRENCY VALUE = "; IC(NC)
   END

   FUNCTION IC(NC)
   IC = NC/1.6
   END FUNCTION

* WAP to calculate potential energy of a body.

> DECLARE SUB PE(M,H)
   CLS
   INPUT "ENTER MASS"; M
   INPUT "ENTER HEIGHT"; H
   CALL PE(M,H)
   END

   SUB P(M,H)
   P = M*H*9.8
   PRINT "POTENTIAL ENERGY ="; P
   END SUB

> DECLARE FUNCTION PE(M,H)
   CLS
   INPUT "ENTER MASS";M
   INPUT "ENTER HEIGHT"; H
   PRINT "POTENTIAL ENERGY = ";PE(M,H)
   END

   FUNCTION PE(M,H)
   PE = M*H*9.8
   END FUNCTION

Comments