Ch 6: Advanced Features
of QBASIC
Exercise:
I.
Fill in the
blanks :
1.
String Functions
2.
For .. Next
3.
Exit
5.
String resolution
II.
State true or
false:
1.
True
2.
False
3.
False
4.
True
5.
False
Practical Exercises :
1. For a=1 to 5
Print “BCBS”
Next a
End
2. For i=1 to 10
Print “5 * “ ;
i ; “*” ; 5*i
Next i
End
In the above
program we are printing the table of 5.
In the print
statement 5 * is given within double quotes, so it
will be printed as it is.
Then there is a semicolon(;) to give
space between the letters. * within
quotation will be printed as
it is, then semicolon will give space and then
finally 5*i will
give the multiplication value. Remember it is not within
quotation, because we don’t want it to be printed as it is but
we want the
product.
3
For x= 19 to 1
step - 2
Print x
Next x
End4 a.
Screen 9
Line (10,10) – (150,60),
5, B
Line (10,70) – (150,120),
5, B
Line(10,130) – (150,
180) , 5 , B
End
In this program we are
drawing three rectangles one below the other. You can draw a square or a
rectangle using 4 Line commands without B, or you can follow
the above method where we write only one statement for a square or a rectangle.
4 b.
Screen 9
Circle (100,100), 50
Circle (100, 250) , 50
End
No comments:
Post a Comment