Saturday, September 23, 2017

Sequential Structure – Find Output [SEE Qbasic Practice]

Write the output of the following programs: [12 Programs]

1.      DECLARE FUNCTION Interest (p,q,r)
CLS
LET p = 30
LET t = 40
LET r = 6
LET d = Interest (p, t, r)
PRINT “The simple interest will be”; d
END

FUNCTION Interest (p, t, r)
answer= (p*t*r) /100
Interest=answer
END FUNCTION

2.      DECLARE FUNCTION Interest (p,t,r)
CLS
LET p = 100
LET t = 2
LET r = 5
LET d = Interest (p, t, r)
PRINT "The simple interest =" ; d
END

FUNCTION Interest (p, t, r)
ans= (p*t*r) /100
Interest=ans
END FUNCTION

3.      DECLARE FUNCTION AREA (A,B)
CLS
LET A = 30
LET B = 40
LET D = AREA(A,B)
PRINT D
END

FUNCTION AREA(A,B)
PRINT A, B
AREA=A*B
END FUNCTION

4.      DECLARE FUNCTION AREA(L, B)
LET L = 10
LET B = 5
PRINT “The area=”; AREA(L, B)
END
FUNCTION AREA(L, B)
A = L*B
AREA = A
END FUNCTION

5.      DECLARE FUNCTION AVGE(A, B, C)
X=10
Y=5
Z=15
AV= AVGE(X, Y, Z)
RPINT “Average of three numbers”; AV
END

FUNCTION AVGE(A, B, C)
S=A+B+C
AVGE = S/3
END FUNCTION

6.      DECLARE   FUNCTION   Area (L,B)
LET   L = 100
LET   B = 20
LET   ans = Area (L,B)
PRINT  “The area is”; ans
END

FUNTION   Area (L, B)
ar = L * B
Area = ar
END FUNCTION


7.      DECLARE FUNCTION SQUARE (number)
CLS
Number = 9
num = SQUARE (number)
PRINT num; “square=”; num
END

FUNCTION SQUARE (number)
SQUARE = number * number
END FUNCTION

8.      DECLARE FUNCTION AREA(L, B)
CLS
LET length = 50
LET breadth = 60
PRINT AREA (length, breadth)
PRINT AREA (10, 20)
END

FUNCTION AREA (L, B)
AREA = L * B)
END FUNCTION


9.      DECLARE SUB PAT (A)
A= -144
CALL PAT (A)
END

SUB PAT(A)
B=ABS(A)
C= SQR(B)
D=C MOD 2
PRINT A, B, C, D
END SUB

10.   DECLARE SUB output (N$, A)
NAME$ = “SADEEP”
AGE = 17
CALL output (NAME$, AGE)
CALL output (Sita, 20)
END

SUB output (N$, A)
PRINT “Hello”; N$
PRINT “You are”; A; “years old”
END SUB

11.   DECLARE SUB SHOW (S)
CLS
CALL SHOW (534)
END

SUB SHOW (N)
A = N MOD 10
B = N \ 10
C = B MOD 10
D = INT (N / 100)
PRINT “Ans=”; A + C + D
END SUB

12.   DECLARE SUB VOL (L, B, H)
CLS
LET L1 = 20
LET B1 = 14
LET H1 = 2
CALL VOL(L1, B1, H1)
END

SUB VOL (L, B, H)
LET V = L * B * H
PRINT “Volume=”; V
END SUB


***

No comments:

Post a Comment