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   ...

questions

1.             What is server? The main computer which provides services to the other computers in a network environment is called server.                                    2.             What is workstation? A workstation is a computer where a user can work and takes services, access shared data and software to the client computer. 3.             What is repeater? A repeater is a device of a network that regenerates a signal. 4.             What is network operating system? A group of programs which are used to manage the resources on the network is called network operating system. ...