You are on page 1of 2

Here is the set of problems based on topics covered in today’s class:

1. Print the multiplication table of 5


Solution => This is how it would like on the screen
PRINT 5*1
PRINT 5*2
PRINT 5*3
PRINT 5*4
PRINT 5*5
PRINT 5*6
PRINT 5*7
PRINT 5*8
PRINT 5*9
PRINT 5*10

A better solution =>


This is how it tooks on the screen
PRINT “5 * 1 = “, 5*1
PRINT “5 * 2 = “, 5*2
PRINT “5 * 3 = “, 5*3
PRINT “5 * 4 = “, 5*4
PRINT “5 * 5 = “, 5*5
PRINT “5 * 6 = “, 5*6
PRINT “5 * 7 = “, 5*7
PRINT “5 * 8 = “, 5*8
PRINT “5 * 9 = “, 5*9
PRINT “5 * 10 = “, 5*10

A much better generic solution, which is NOT dependent on the data


READ “You need multiplication table for which number: “, num
PRINT num, " * 1 = ", num*1
PRINT num, " * 2 = ", num*2
PRINT num, " * 3 = ", num*3
PRINT num, " * 4 = ", num*4
PRINT num, " * 5 = ", num*5
PRINT num, " * 6 = ", num*6
PRINT num, " * 7 = ", num*7
PRINT num, " * 8 = ", num*8
PRINT num, " * 9 = ", num*9
PRINT num, " * 10 = ",
num*10

2. you bought 10 boxes of five samosas/box. You gave away 12 samosa, how many do
you have now?
3. 29 birds were sitting in a tree. Some more fly up to the tree. Then there were 142
birds in the tree. How many more flew up to the tree?
4. The city park is 9 KM from school. The city library is 3 KM in the same direction from
the same school. How much farther from the school is the park than the library?
5. I travelled 110 miles today. How much was that in kilometres?
6. The size of my plot is 30x80 feet? How much is that in square yards?
7. The radius of a circle is 10 feet. What is its area and circumference?
8. Box A is 2 metre long and 5 metre wide. Box B is 4 metre long and 4 metre wide.
What's the difference in their area?
9. Find the area and perimeter of a field that is 30 metre wide and 80 metre long.
10. The heights of students in a class are 5.6, 5.8, 6, 5.4, 5.5 and 6.1 feet. What's the
average height of the students in that class?

Steps to be followed in writing code:


1. Understand the PROBLEM statement
2. Identify the INPUT & OUTPUT
3. Identify the tool(s) needed
4. Layout the instructions (Logic/Code)
5. Execute (Run/Test/Check)

====
BLOCK
{
}

SELECTION
If (condition is TRUE)
{
}
Else
{
}

Condition can be:


>
<
=
!

REPETITION
for( initial value; condition; repeat action)
{
}

You might also like