You are on page 1of 4

1.

Write a program which:


 Input English and Maths test score of a student
 Output the test results obtained based on condition in table.
Condition Output texts
English test score was less than 40 Student failed both tests
and Maths test score was less than
50
English test score was less than 40 Student failed one test
or Maths test score was less than 50
English test score was at least 80 Student passed both tests with distinction
and Maths test score was at least 85
other conditions Student passed both tests

DECLARE English, Maths : INTEGER


OUTPUT “Enter your marks”
INPUT English
INPUT Maths

IF English < 40 AND Maths <50


THEN
OUTPUT “Student failed both tests”
ELSE
IF English < 40 OR Maths < 50
THEN
OUTPUT “Student failed a test”
ELSE
IF English >= 80 AND Maths >= 85
THEN
OUTPUT “Student passed both tests with destination”
ELSE
OUTPUT “Student passed both tests”
ENDIF
ENDIF
ENDIF

2.The input number should has either one digit (e.g. 5), two
digits (e.g. 36), three digits (e.g. 149) or four digits (e.g. 8567).
Write a python program, which
 accept input number
 outputs this number has one digit or two digits or three dights or four
digits or other.

DECLARE Num : INTEGER


OUTPUT “Enter your number between 0 to 9999:”
IF Num >= 0 AND Num <= 9 THEN
OUTPUT “This number has one digit.”
ELSE
IF Num >= 10 AND Num <= 99 THEN
OUTPUT “This number has two digits.”
ELSE
IF Num >= 100 AND Num <= 999 THEN
OUTPUT “This number has three digits.”
ELSE
IF Num >= 10000 AND Num <= 9999 THEN
OUTPUT “This number has four digits.”
ELSE
OUTPUT “Invalid number!”
ENDIF
ENDIF
ENDIF
ENDIF

3.Each house owner must pay tax based on the value of the house. Houses over $
200000 pay 2% of their value in tax, houses over $ 100000 pay 1.5% of their value
in tax and houses over $ 5000 pay 1% of their value in tax. All others pay no tax.
Write an algorithm to solve the problem using.

Tax Housevaule * 0.02 (if housevalue > 200000)


Tax Housevalue * 0.015 ( if housevalue > 100000)
Tax Housevalue * 0.01 ( if housevalue > 50000 )
Tax  0 ( Other)
OUTPUT “Enter Your House Value:”
INPUT Housevalue
IF Housevalue > 200000 THEN
Tax Housevalue * 0.02
OUTPUT “Your Tax is:”, Tax
ELSE
IF Housevalue > 100000 THEN
Tax Housevalue * 0.015
OUTPUT “Your Tax is:”, Tax
ELSE
IF Husevalue > 50000 THEN
Tax Housevalue * 0.01
OUTPUT “Your Tax is:”, Tax
ELSE
Tax 0
OUTPUT “Your Tax is:”, Tax
ENDIF
ENDIF
ENDIF

4. Tickets are sold for a concert at $20 each, if 10 tickets are bought then
the discount is 10%, if 20 tickets are bought the discount is 20%. No
more than 25 tickets can be bought in a single transaction.
Write a program to calculate the cost of buying a given number of tickets.

DECLARE Tickets, Cost : INTEGER


OUTPUT “Enter the number of tickets you want to buy.”
INPUT Tickets
IF Tickets >= 10 AND Tickets <=19 THEN
Cost  (Tickets * 20) -

5. A system is required to calculate the delivery cost of parcels. All


parcels have a fixed charge if the parcel is 5 kg or below in weight. For
local delivers this charge is $ 20; for international delivers the charge
raises to $ 40.The maximum weight limit for international deliveries is 5
kg; however, for local deliveries extra weight is permitted and charged at
$ 1 for every 1 kg above that limit.

You might also like