You are on page 1of 1

Computer Science

Teacher: Maruf Ahmed


Worksheet of basic algorithm

Write down the python code, pseudocode as well as draw the flowchart to solve the following
problems.
Proper prompt should be given before taking input. Proper variable names should also be given.
1. A name will be entered by a user and it will be taken as an input. Display the name with the
message “Good morning”. The output should be Good morning followed by the name that has
been taken as input.
2. Take input of two numbers in two variables. Assume that values will not be equal. Check which
number is greater with proper message. Display the message with the values that have been
entered. For example, 20 is greater than 10.
3. Take a temperature as input. If the temperature is greater than or equal to 20 then display the
message “It is quite hot”. Anything other than that display the message “It is quite comfortable”.
4. Take input of a number and check if the number is larger than 100, smaller than 100 or equal to
100 with proper message. The output message should also display with the value that has been
input. For example, 200 is greater than 100
5. A garage sells cars. The amount of road tax is based on engine size. Engines over 3 litres in size
incur a tax of $500, engines over 2 litres in size incur a tax of $300 and engines over 1 litre in size
are at the rate of $100. Cars with engines below or equal to 1 litre incur no road tax. Take input of
Engine size and display the proper output message.
6. User will be asked to enter a value from 1 to 4 for choosing an option. Two other inputs for any
two numbers will also be taken as input for doing calculation.
- If option 1 is chosen, multiply the two numbers
- If option 2 is chosen, divide the two numbers
- option 3 is chosen, add the two numbers
- option 4 is chosen, subtract the two numbers
- Any other option chosen by the user, an error message must be displayed
For solving the problem, display the list of options first. After the inputs are taken, calculate and
display the calculated result. Solve the problem using CASE structure.

You might also like