Skip to main content

SUB N FUNCTION PROCEDURE

 1.To find the volume of cylinder and volume of hemisphere.

=>USING SUB procedure
DECLARE SUB CYLINDER(R,H)
 DECLARE SUB HEMISPHERE(R)
CLS
INPUT "ENTER RADIUS";R
INPUT "ENTER HEIGHT";H
CALL CYLINDER(R,H)
CALL HEMISPHERE(R)
END

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


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


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

SUB CYLINDER(R,H)
CYLINDER=22/7*R^2*H
END SUB


SUB HEMISPHERE(R)
HEMISPHERE=2/3*22/7*R^3
END SUB


2. To convert Nepali currency into US dollar.


=>USING SUB procedure
DECLARE SUB DOLLAR(NC)
CLS
INPUT "ENTER NEPALI CURRENCY";NC
CALL  DOLLAR(NC)
END

SUB DOLLAR(NC)
D=NC/100
PRINT "US DOLLAR=";D
END SUB


 USING FUNCTION procedure
DECLARE FUNCTION DOLLAR(NC)
CLS
INPUT "ENTER NEPALI CURRENCY";NC
PRINT "US DOLLAR=";DOLLAR(NC)
END

FUNCTION  DOLLAR(NC)
DOLLAR=NC/100
END FUNCTION


3.Calculate the area of sphere.

=>USING SUB procedure
DECLARE SUB AREA(R)
CLS
INPUT "ENTER RADIUS";R
CALL AREA(R)
END

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


=>USING FUNCTION procedure
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 FUNCTION



4. To convert US dollar. into Nepali currency


=>USING SUB procedure
DECLARE SUB CURRENCY(D)
CLS
INPUT "ENTER DOLLAR";D
CALL  CURRENCY(D)
END

SUB CURRENCY(D)
NC=D*100
PRINT "NEPALI CURRENCY=";NC
END SUB


 USING FUNCTION procedure
DECLARE FUNCTION CURRENCY(D)
CLS
INPUT "ENTER NEPALI CURRENCY";NC
PRINT "US DOLLAR=";CURRENCY(D)
END

FUNCTION CURRENCY(D)
CURRENCY=D*100
END FUNCTION

 

5.Calculate T.S.A of sphere.


=>USING SUB procedure
DECLARE SUB AREA(R)
CLS
INPUT "ENTER RADIUS";R
CALL AREA(R)
END

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


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

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











Comments

Popular posts from this blog

17 QBASIC Programming

1. Create a sequential file "std.dat" to store name and marks obtained in English, Math and Science subjects for a few students. (74 set 1) OPEN   “std.dat”   FOR OUTPUT   AS   #1 DO CLS INPUT “Enter name “; N$ INPUT   “Enter English marks”; E INPUT “Enter Math's marks"; M INPUT "Enter Science marks"; S WRITE #1, N$, E, M, S INPUT "Do you want to continue (Y/N)";CH$ LOOP WHILE UCASE$ (CH$) "Y" CLOSE #1 END 4.   WAP to add some more   records in a data file “ABC.DAT” having following fields : patient’s name, address and age.  OPEN   “ABC.DAT”   FOR OUTPUT   AS   #1 DO CLS INPUT “Enter Patients name “; N$ INPUT   “Enter patients address”; A$ INPUT “Enter Patient's age "; A WRITE #1, N$, A$, A INPUT "Do you want to continue (Y/N)";CH$ LOOP WHILE CH$="Y" OR CH$="y" CLOSE #1 END       6.WAP to store records regarding the information of book’s number, name and author’s ...

QBASIC Solutions

Q.1) WAP to change degree Celsius into degree Fahrenheit.   => CLS        INPUT "Enter degree celsius value" ; D        F = ( 9 * C / 5 ) + 32        PRINT "Degree Fahrenheit value = "; F        END Q.2) WAP to change dollar into Nepali currency.   => CLS       INPUT "Enter Dollar value"; USD        NRS = USD * 100       PRINT "Nepali currency value = "; NRS       END Q.3) WAP to change Indian currency into Nepali currency. => CLS                   INPUT "Enter Indian currency value"; IC       NRS = IC * 1.6        PRINT "Nepali currency value = "; NRS   ...
MOTHER'S DAY Mother's Day  is a celebration honoring the mother  of the family, as well as motherhood, maternal bonds, and the influence of mothers in society. It is celebrated on various days in many parts of the world, most commonly in the months of March  or May .  MOTHER'S DAY is complements similar celebrations honoring family members, such as Father's day  and Siblings day . Mother's day is the most special day for a mom. This is the day the children's show there love to there mom. The mom always waits for this day.  In Nepal it is known as amma ko mukh herne din.  My mother is the most important person in my life. She always cares about me. She is the most caring and loving mom in the world. my mother's name is Sunita Dangol. She is thirty-eight years old. She gave birth to me. She taught me to walk. She sent me school so that, I can do better. It's always have been my dream to make my mother  be proud for my go...