Saturday, October 1, 2022

QBASIC Modular Programming - FInd Output - SEE Computer Science 2079

 Find Output

 

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

 

3. [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

 

4. [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

 

5. [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

 

6. [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

 

7. SEE 2078

DECLARE SUB ABC(A)

A=2

CALL ABC(A)

END

 

SUB ABC(A)

FOR J= 1 TO 5

PRINT A;

A=A+3;

NEXT J

END SUB

 

8. SEE Grade Promotion 2078

 

DECLARE SUB Series(A)

CLS

A=20

CALL Series(A)

END

 

SUB Series(A)

FOR K=1 to 5

PRINT A;

A=A+10

NEXT K

END SUB

 

9. [MM 2076]

DECLARE SUB NUM( )

CLS

CALL NUM

END

SUB NUM

A=3

B=7

FOR I =1 TO 5 STEP 2

PRINT A;

SWAP B, A

B=A+1

NEXT I

END SUB

 

10. SOS 2078

DECLARE SUB Series( )

CALL Series

END

SUB Series( )

D = 5

FOR J = 8 to 2 STEP-2

PRINT D;

SWAP D, B

D = B+1

NEXT J

END SUB

 

11. MFT 2076

 

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

12. [SLC 2066]

DECLARE SUB Series( )
CALL Series
END


SUB Series
X=1
Y=1
FOR Z=1 TO 4
PRINT X;
Y=Y+1
X=X*10+Y
NEXT Z
END SUB

 

13. JEC 2078

DECLARE SUB Seri( )

CLS

CALL Seri

END

 

SUB Seri

A=1

B=1

FOR i=1 To 2

PRINT A; B;

A=A+B

B=A+B

NEXT i

END SUB

 

 

14. [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

 

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. PABSON FIRST TERM 2079

 

DECLARE SUB result ( )

CLS
CALL result

END

 

SUB result ( )

FOR I = 9 to 1 step -2

Sum = sum + i^2

NEXT i

PRINT sum

END SUB

 

 

17. [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

 

18. NPABSON PRE BOARD 2078

DECLARE FUNCTION FACT (N)

CLS

N=5

PRINT FACT (N)

END

FUNCTION FACT (N)

F=1

FOR I=1 TO N

F=F*I

NEXT I

FACT=F

END FUNCTION

 

19. [SEE 2075 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

20. PABSON PRE BOARD  2078

DECLARE SUB DISPLAY (A)

A= 3

CALL DISPLAY (A)

END

SUB DISPLAY (A)

FOR X = 1 TO 6

PRINT A;

IF A MOD 2 = 0 THEN

A=A/2

ELSE

A= (A*3)+1

END IF

NEXT X

END SUB

21. [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

22. [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

23. [SEE 2074 U]

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

IFR1 = 0 AND R2<> 0 THEN      

PRINT R

END IF

 END SUB

24. SEDIPS 2078

DECLARE SUB SERIES( N )

CLS

FOR I = 1 TO 5

READ N

CALL SERIES (N)

NEXT I

DATA 125, 1000, 216, 8, 27

END

 

SUB SERIES(N)

PRINT N^1/3 + 1

END SUB

25. NPABSON 2078

 

DECLARE FUNCTION Sendup(N)

N=10

PRINT Sendup(N)

END

FUNCTION Sendup(N)

FOR I = 1 TO N

IF I MOD 2 = 0 THEN

Sum = SUM + I

END IF

NEXT I

Sendup = SUM

END FUNCTION

 

26. MODEL SET 2

DECLARE FUNCTION OUTPUT1(A)

N=135

CALL OUTPUT1(N)

END 

 

SUB OUTPUT1(A)

DO WHILE A < > 0

R = A MOD 10

T = T + R

A = A \ 10

LOOP

PRINT T

END SUB

 

27. [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

28. PMT 2075

 

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

 

29. SQE 2074K]

 

DECLARE SUB SERIES()[

CLS

CALL SERIES

END

 

SUB SERIES()

R=2

M=5

WHILE M>=1

PRINT R

R=R*10+2

M=M-1

WEND

END SUB

 

30. [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

31. MAAF FT 2079

DECLARE SUB Num ( )

CALL Num

END

SUB Num

N=2

A=5

C=1

WHILE C <= 9

PRINT N

N=N*3+A

A=A-1

C=C+2

WEND

END SUB

32. MODEL SET 1

DECLARE SUB SHOW(A)

N=87

CALL SHOW(N)

END 

SUB SHOW(A)

DO

B=A MOD 6+3

IF B MOD 4=0 THEN GOTO AA

PRINT B;

AA:

A=A-10

LOOP WHILE A>=50

END SUB

33. PABSON 2079 SET C

DECLARE SUB Result(A)
A=5

CALL Result(A)

END

 

SUB Result(A)

WHILE A<=15

IF A MOD 4=0 THEN S=S+A

A=A+3

WEND

PRINT S

END SUB

 

34. SET

DECLARE SUB PRO (A AS INTEGER, B AS STRING)

N = 62

CALL PRO (N, S$)

PRINT S$

END

 

SUB PRO (A AS INTEGER, B AS STRING)

X = A

DO

R = X MOD 8

B = STR$ (R) + B

X = (X - R) / 8

LOOP UNTIL X = 0

END SUB

 

35. SEE Grade Promotion 2078

DECLARE SUB Result(C$)

C$=”COMPUTER”

CALL Result(C$)

END

 

SUB Result(C$)

FOR C=1 TO LEN(C$) STEP 2

M$=MID$(C$,C,1)

N$=N$+M$

NEXT C

PRINT N$

END SUB 

 

36. [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

37. [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

 

38. SET

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

 

39. [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

 

40. PABSON PRE BOARD 1

DECLARE SUB SERI ( )

CLS

CALL SERI

END

 

SUB SERI

               A$ = "SCIENCE"

               B = LEN (A$)

               FOR I = 1 TO 4

                     PRINT TAB(I); MID$(A$, I, B)

                              B =B-2

               NEXT I

END SUB

41. DECLARE SUB PATTERN (W$)

CLS

LET W$=”KATHMANDU”

CALL PATTERN (W$)

END

SUB PATTERN (W$)

T=5

FOR K=1 TO LEN(W$) STEP 2  

PRINT TAB(T); MID$(W$,T,K)

T=T-1

NEXT K

END SUB

42. SET

DECLARE SUB SHOW (ABC$)

AB$="ZHTUOMENXSA"

CALL SHOW (AB$)

END

SUB SHOW (AB$)

Y=48

FOR I=1 TO 5

N=Y MOD 7

PRINT MID$(AB$, N, 1);

Y=Y-1

NEXT I

END SUB

43. DECLARE FUNCTION CONV$(D)

CLS

D = 509

PRINT CONV$(D)

END

FUNCTION CONV$(D)

WHILE D<>0

R = D MOD 16

IF R < 10 THEN

S$ = STR$(R) +S$

ELSE

S$ = CHR$(R+55) +S$

END IF

D = D\16

WEND

CONV$ = S$

END FUNCTION

44. DECLARE SUB DISPLAY(B$)

CLS

CALL DISPLAY(“101”)

END

SUB DISPLAY(B$)

FOR I=LEN(B$) TO 1 STEP-1

A$=MID$(B$,I,1)

C=VAL(A$)

D=D+C*8^P

P=P+1

NEXT I

PRINT D

END SUB

45. SET

DECLARE SUB DISPLAY(S$)

A$=”MAAF”

DISPLAY A$

END

SUB DISPLAY(S$)

L=LEN(S$)

FOR I=L TO 1 STEP -1

VER$=MID$(S$, I, 1)

IF I MOD 2 =1 THEN

CON$=CON$+LCASE$(VER$)

ELSE

CON$=CON$+UCASE$(VER$)

END IF

NEXT

PRINT CON$

END SUB

46. DECLARE SUB TEST(A$)

A$ = “COMPUTER”

CALL TEST(A$)

END

SUB TEST(A$)

FOR I=1 TO LEN(A$)

B$=MID$(A$,I,1)

C=ASC(B$)

IF C MOD 2 =0 THEN

D$=D$+CHR$(C+32)

ELSE        

D$=D$+B$

ENDIF

NEXT I

PRINT D$

END SUB

47. SET

DECLARE FUNCTION VCOUNT(A$)
X$=”SCHOOL”
Y$=” INSTITUTE”
IF VCOUNT(S$)>VCOUNT(Y$) THEN PRINT X$ ELSE PRINT Y$
END

FUNCTION VCOUNT(A$)
N$=UCASE$(A$)
FOR X= 1 TO LEN(N$)
C$=MID$(N$,I,1)

IF C$=”A” OR C$=”E” OR C$=”I” OR C$=”O” OR C$=”U” THEN V=V+1
END IF
NEXT X
VCOUNT=V
END FUNCTION

LET N$= “COMPUTER SCIENCE”

CALL RESULT (N$)

END

SUB RESULT (N$)

FOR I= 1 TO LEN (N$) STEP 2

B$=B$ + MID$(N$, I, 1)

NEXT I

PRINT B$

END SUB

48. SEDIPS

 

      DECLARE FUNCTION OUT$(A$( ))

DIM A$(6)

FOR A = 0 to 5

READ A$(A)

NEXT A

DATA SARITA, JEHEN, RADHIKA, ISHIKA, DILIP, BRIJESH

PRINT OUT$(A$( ))

END

 

FUNCTION OUT$(A$( ))

CTR = 1

FOR R = 0 TO 5

T$ = T$ + MID$ (A$(R), CTR, 1)

CTR = CTR + 1

NEXT R

OUT$ = T$

END FUNCTION

 

49. DECLARE FUNCTION RE$(ST$( ))

DIM ST$(7)

CLS

FOR I=1 TO 7

INPUT "Enter string"; ST$(I)

NEXT I

PRINT  RE$(ST$())

DATA “Prabhu”, “Alok”, “Bimal”, “Suman”, “Ishwor”, “Om”, “Nitu”

END

FUNCTION RE$(ST$()))

FOR J = 1 TO 7

VR$ = VR$ + MID$(ST$(J), I,1)

NEXT J

RE$=VR$

END FUNCTION

 

50. DECLARE FUNCTION OUTP$(A$( ))

DIM A$(5)

FOR I=1  TO 5

READ A$(I)

NEXT I

DATA NETRA, NAVIN, SUSAN, GOPAL, SUNIL

PRINT OUTP$(A$())

END

FUNCTION OUTP$(A$())

SWAP A$(1),A$(2)

SWAP A$(3),A$(4)

FOR J=1 TO 5

T$=T$+MID$(A$(J),J,1)

NEXT J

OUTP$=T$

END FUNCTION

No comments:

Post a Comment