Qbasic program learning SUB Procedure

 1. Using sub.......END Sub ,Write a program to convert temperature given in centigrade into fahrenheit. F=(9C + 160)/5


DECLARE SUB Fahrenheit (C)

CLS

INPUT"ENTER THE Centigrade ";C

CALL Fahrenheit (C)

END 

SUB  Fahrenheit (c)

F = (9 * C +160)/5

PRINT "The fahrenheit is ";F

END SUB


2. Write a program to calculate simple interest using SUB...END..SUB

DECLARE SUB interest (P , T , R)

INPUT "Enter the principal ammount "; P

INPUT "Enter the time ";T

INPUT "Enter the rate ";R

CALL Interest (P,T,R)

END 

SUB Interest (P,T,R)

I = (P * T * R)/100

PRINT "The simple interest ";I

END SUB 

3. Write a SUB program to display area of circle sphere ACO =PR2 , AOS =4PR2

DECLARE SUB area (r)

CLS 

INPUT " Enter the radius ";r

CALL area (r)

END 

SUB area (r)

AOC = 22/7*R^2

AOS = 4*22/7*R^2

PRINT AOC 

PRINT AOS 

END SUB 


4. Write a program to create a function to convert nepali currency its equivalent US doller . 1$ =1Nrs.75

DECLARE SUB DOLLER (n)

CLS 

INPUT "Enter the n";n

CALL DOLLER (n)

SUB DOLLER (n)

D = n/75

PRINT "the doller is ";D

END SUB

5. Write a program find the velocity V=u+at

DECLARE SUB Velocity ( u,a,t)

CLS 

INPUT "Enter the u";u

INPUT "Enter the a";a

INPUT "Enter the t";t

CALL Velocity (u ,a ,t)

END 

SUB Velocity (u , a , t)

V =u + a*t

PRINT "THE velocity is ";V

END SUB




Comments

Popular posts from this blog

Qbasic Importance questions for SEE EXAM

QBASIC Programming for SEE for Students

सत्यको कुनै एउटा पहिचान,