Simple QBASIC | |
CLS INPUT "ENTER THREE NUMBERS" ; A,B,C LET X = A + B + C PRINT "THE SUM OF THREE NUMBERS IS " ; X END |
|
Using SUB Procedure | |
DECLARE SUB SUM(A,B,C) CLS INPUT "ENTER THREE NUMBERS" ;A,B,C CALL SUM(A,B,C) END SUB SUM(A,B,C) X = A+B+C PRINT "THE SUM OF THREE NUMBERS IS "; X END SUB |
|
Using FUNCTION - END FUNCTION | |
DECLARE FUNCTION SUM(A,B,C) CLS INPUT "ENTER THREE NUMBERS" ;A,B,C X = SUM(A,B,C) PRINT "THE SUM OF THREE NUMBERS IS "; X END FUNCTION SUM(A,B,C) SUM = A+B+C END FUNCTION |
Simple QBASIC | |
CLS INPUT "ENTER A TEMPERATURE IN FAHRENHEIT" ; F C = 5*(F-32)/9 PRINT "THE DEGREE IN CELSIUS IS"; C END |
|
Using SUB Procedure | |
DECLARE SUB CONV(F) CLS INPUT "ENTER A TEMPERATURE IN FAHRENHEIT" ; F CALL CONV(F) END SUB CONV(F) C = 5*(F-32)/9 PRINT "THE DEGREE IN CELSIUS IS"; C END SUB |
|
Using FUNCTION - END FUNCTION | |
DECLARE FUNCTION CONV(F) CLS INPUT "ENTER A TEMPERATURE IN FAHRENHEIT" ; F X = CONV(F) PRINT "THE DEGREE IN CELSIUS IS" ; X END FUNCTION CONV(F) C = 5*(F-32)/9 CONV = C END FUNCTION |
Simple QBASIC | |
CLS INPUT "ENTER PRINCIPAL, TIME AND RATE" ; P,T,R SI = P*T*R/100 PRINT "THE SIMPLE INTEREST IS"; SI END |
|
Using SUB Procedure | |
DECLARE SUB SI(P,T,R) CLS INPUT "ENTER PRINCIPAL, TIME AND RATE" ; P,T,R CALL SI(P,T,R) END SUB SI(P,T,R) S = P*T*R/100 PRINT "THE SIMPLE INTEREST IS"; S END SUB |
|
Using FUNCTION - END FUNCTION | |
DECLARE FUNCTION SI(P,T,R) CLS INPUT "ENTER PRINCIPAL, TIME AND RATE" ; P,T,R X = SI(P,T,R) PRINT "THE SIMPLE INTEREST IS"; X END FUNCTION SI(P,T,R) SI = P*T*R/100 END FUNCTION |
Comments
Post a Comment