Find
Output [22]
1.
[SLC 2065 S]
DECLARE
FUNCTION Interest (p,t,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.
[SLC 2072]
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
|
|||
Output:
The simple
interest will be 72
|
Output:
The simple
interest = 10
|
|||
3.
[SLC 2064]
DECLARE
FUNCTION AREA (A,B)
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.
[SLC 2068 S] [SLC 2070] [SLC 2073]
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
|
|||
Output:
30 40
1200
|
Output:
The area= 50
|
|||
5.
[SLC 2071]
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.
[SLC 2067 S]
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
|
|||
Output:
Average of three numbers 10
|
Output:
The area is 2000
|
|||
7. [PMT
2075]
|
8. [MFT
2076]
|
||
DECLARE SUB SER (P)
P
= 15
CALL
SER (P)
END
SUB
SER (P)
M
= 3
WHILE
M < 10
PR
= M * P
PRINT
PR,
M
= M + 2
WEND
END
SUB
|
DECLARE
SUB sum( )
CLS
CALL
sum
END
SUB
sum
P = 2
A = 1
FOR K
= 8 to 2 STEP -2
N = N
+ A
PRINT
N
A = A
+ P
NEXT
K
END
SUB
|
||
Output is:
45 75 105 135
|
Output
1
4
9
16
|
||
9.
[SLC 2066 S]
DECLARE SUB Result ( )
CALL Result END
SUB
Result
For I = 1 to 9 STEP 2 Sum=Sum +I^2 Next I PRINT Sum END SUB |
10.
[SLC 2070 S]
DECLARE SUB Series ()
CALL Series
END
SUB Series
X = 0
FOR K = 10 TO 4 STEP -2
A = K ^2
X
= X + A
NEXT K
PRINT X
END SUB
|
||
Output:
165
|
Output:
216
|
||
11.
DECLARE SUB SERIES()[SQE 2074K]
CALL
SERIES
END
SUB
SERIES()
R=2
M=5
WHILE
M>=1
PRINT
R
R=R*10+2
M=M-1
WEND
END SUB
|
12.
[SEE 2075 S2]
DECLARE FUNCTION SQD(N)
S = 0
FOR L = 1 TO 3
READ NUM
S = S +SQD
(NUM)
NEXT L
PRINT " Sum" ; S
DATA 2,4,6
END
FUNCTION SQD (N)
SQD = N^2
END FUNCTION
|
||
Output:
2
22
222
2222
22222
|
Output:
Sum 56
|
||
13.
[SEE 2071 S]
DECLARE FUNCTION
test (N)
CLS
FOR Ctr = 1 TO 3
READ N
Sum = Sum + test (N)
NEXT Ctr
PRINT “The result=”;
Sum
DATA 3, 2, 1
END
FUNCTION test (N)
Test = N^2
END FUNCTION
|
14.
[SEE 2073 U]
DECLARE SUB CHECK
(N)
CLS
N = 1436
CALL CHECK (N)
END
SUB CHECK (N)
DO WHILE n< >0
R = N MOD 10
S = S*10+R
N = N\10
LOOP
PRINT "NOW N
BECOMES"; S
END SUB
|
|
Output:
The
result = 14
|
Output:
NOW N BECOMES 6341
|
|
15. [SQE 2075K]
DECLARE
FUNCTION RESULT (N)
N = 4 PRINT RESULT (N) END FUNCTION RESULT (N) FOR I = 1 TO N T = I + 2 D = D + T NEXT I RESULT = D END FUNCTION |
16. [SLC
2069]
DELARE
SUB NUMBER()
CLS
CALL
NUMBER
END
SUB
NUMBER
N=3
C=1
WHILE
C<=5
PRINT N
N=N*10+3
C=C+1
WEND
END
SUB
|
|
Output:
18
|
Output:
3
33
333
3333
33333
|
|
17.
[SLC 2067]
DECLARE
SUB RESULT(N$)
N$ =
"SCIENCE"
CALL RESULT(N$) END SUB RESULT (N$) B = LEN(N$) COUNT = 1 WHILE COUNT <= B X$ = X$ + MID$(N$, COUNT, 1) COUNT = COUNT + 2 WEND PRINT X$ END SUB |
18. [SEE
2074]
DECLARE SUB Display (T$)
CLS
T$ = "COMPUTER"
CALL Display (T$)
END
SUB Display (T$)
FOR C = 1 TO LEN (T$) STEP 2
D$ = MID$ (T$, C, 1)
PRINT D$;
NEXT C
END
SUB
|
|
Output:
SINE
|
Output:
CMUE
|
|
19.
[SLC
2065]
DECLARE
SUB RESULT(A$)
A$ =
"education"
CALL RESULT(A$) END
SUB
RESULT (A$)
FOR C = 1 TO LEN(A$) STEP 2 X$ = MID$(A$, C, 1) PRINT X$ NEXT C END SUB |
20.
DECLARE
SUB TEST(A$)
CLS
A$="NEPAL"
CALL
TEST(A$)
END
SUB
TEST(A$)
FOR I
= 1 TO LEN(A$)
B$ =
MID$(A$, I, 1) + B$
NEXT
I
PRINT
B$
END
SUB
|
|
Output:
e
u
a
i
n
|
Output:
LAPEN
|
|
|
|
|
21.
[SEE 2075 U]
|
22. [SEE
2074 U]
|
|
DECLARE FUNCTION SUM
( a )
a = 9
PRINT SUM ( a )
END
FUNCTION SUM ( a )
FOR K = 1 to a
IF K MOD 2 = 0 THEN
S = S + K
END IF
NEXT K
SUM = S
END FUNCTION
|
DECLARE SUB REMINDER (R)
FOR I
= 1 TO 4
READ
X
CALL
REMINDER (X)
NEXT
I
DATA
56, 28, 8, 48
END
SUB
REMINDER (R)
R1 =
R MOD 4
R2 =
R MOD 3 IF
R1 =
0 AND R2<> 0 THEN
PRINT
R
END
IF
END SUB
|
|
Output:
20
|
Output:
56
28
8
|
|
How to download it sir
ReplyDelete