(FUNCTION PROCEDURE)
#WAP to find the volume of cylinder and hemisphere
>DECLARE FUNCTION CYL( R, H)
DECLARE FUNCTION HEMI(R)
CLS
INPUT" ENTER RADIUS"; R
INPUT" ENTER HEIGHT OF CYLINDER"; H
END
FUNCTION CYL (R , H)
VOL=22/7*R^2*H
PRINT" VOLUME OF CYLINDER ="; VOL
END FUNCTION
FUNCTION HEMI(R)
H= 2/3*22/7*R^3
PRINT "VOLUME OF HEMISPHERE ="; H
END FUNCTION
#WAP to convert Nepali currency into US dollar.
>DECLARE FUNCTION D(NC)
CLS
INPUT "ENTER NEPALI CURRENCY VALUE";NC
END
FUNCTION D(NC)
US = NC/109
PRINT" AMERICAN DOLLAR ="; US
END FUNCTION
#WAP to find area of sphere
>DECLARE FUNCTION AREA(R)
CLS
INPUT "ENTER RADIUS OF SPHERE";R
END
FUNCTION AREA(R)
A= 4*22/7*R^2
PRINT "AREA OF SPHERE=";A
END FUNCTION
#WAP to convert US dollar into Nepali currency.
> DECLARE FUNCTION NC(US)
CLS
INPUT'ENTER AMERICAN DOLLAR VALUE";US
END
FUNCTION NC (US)
N= US*109
PRINT 'NEPALI CURRENCY VALUE=";N
END FUNCTION
#WAP convert area and volume of box.
> DECLARE FUNCTION AREA (L,B,H)
DECLARE FUNCTION VOLUME(L,B,H)
CLS
INPUT" ENTER LENGHT"; L
INPUT" ENTER BREADTH"; B
INPUT" ENETER HEIGHT ";H
END
FUNCTION AREA (L,B,H)
A= 2*(L*B+B*H+L*H)
PRINT" AREA OF BOX=";A
END FUNCTION
FUNCTION VOLUME (L,B,H)
V=L*B*H
PRINT "VOLUME OF BOX=";V
END FUNCTION
# WAP to calculate total surface area of sphere.
>DECLARE FUNCTION TSA(R)
CLS
INPUT 'ENTER RADIUS";R
END
FUNCTION TSA(R)
A=2*22/7*R^2
PRINT " TOTAL SURFACE AREA OF SPHERE=";A
END FUNCTION
# WAP to calculate potential energyof a body
> DECLARE FUNCTION PTL(M,H)
CLS
INPUT" ENTER MASS";M
INPUT" ENTER HEIGHT";H
END
FUNCTION PTL(M,H)
P=M*H*9.8
PRINT" POPTENTIAL ENERGY =";P
END FUNCTION
#WAP to convert Nepali currency into Indian currency.
> DECLARE FUNCTION IC(NC)
CLS
INPUT"ENTER NEPALI CURRENCY VALUE";NC
END
FUNCTION IC(NC)
I=NC/1.6
END FUNCTION
Function related all programs are wrong. Because function returns value. Here in your program this concept was not used.
ReplyDelete