QBasic programs collection-Especially for SEE (Grade-10)
QBasic program to know the output of program using dry run table- to print the numeric pattern 5,55,555 etc
'CDC model question set 1
declare sub Result()
Call result
End
Sub result ()
N = 5
C = 1
While C <= 5
Print N
N = N * 10 + 5
C = C + 1
Wend
End Sub
Dry run table with output
N |
C |
C<=5 |
Print N |
N=N*10+5 |
C=c+1 |
5 |
1 |
yes |
5 |
=5*10+5=55 |
2 |
55 |
2 |
yes |
55 |
=55*10+5=555 |
3 |
555 |
3 |
yes |
555 |
=555*10+5=55555 |
4 |
5555 |
4 |
yes |
5555 |
=5555*10+5=55555 |
5 |
55555 |
5 |
yes |
55555 |
=55555*10+5=555555 |
6 |
555555 |
6 |
no |
|
|
|
output:
5
55
555
5555
55555
No comments:
Post a Comment