QBasic programs collection-Especially for SEE (Grade-10)
QBasic program to know the output of program using dry run table- to print the characters from given string.
DECLARE SUB RESULT(A$)
Cls
A$ = "KATHMANDU"
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
DRYRUN for above program
A$ |
C=1 TO 9 STEP
2 |
X$=MID$(A$,C,1) |
PRINT X$; |
|
|
KATHMANDU |
C=1 |
X$=K |
K |
|
|
|
C=3 |
X$=T |
T |
|
|
|
C=5 |
X$=M |
M |
|
|
|
C=7 |
X$=N |
N |
|
|
|
C=9 |
X$=U |
U |
|
|
Output:-
KTMNU
No comments:
Post a Comment