Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

WHILE LOOP Activity Sheet

1 A minibus charges $1.50 per passenger. Write a


structured algorithm to input the number of passengers for
each day terminated by 0. Calculate the daily revenue
and output the number of passengers for each day and
the daily revenue.

2 Write a pseudocode algorithm which prompts the user


to enter the name of each student in a class terminated by
“END". Read their names and output the message “Good
day!” together with their name on the same line of output.

3 The students in your class have a gift exchange


at Christmas. Write a structured algorithm to read the name
of each student and the description of each gift submitted
terminated by “END” and print a gift list for your record.

4 Write a structured algorithm to read the description of a


number of items and the price of each item terminated by
0. Print a price list showing the description and price of
each item.

5 Write a structured algorithm to ask the user to


input a series of numbers terminated by 0. If the number is
greater than 100 print "Number is higher than 100". If it is
less than or equal to 100 but more than 0, print the
number. If it is less than 0 print, “The number is negative”.

6 Write a structured algorithm which prompts the user to


enter a series of positive numbers. It should continue to
prompt the user to input a positive number until a zero is
entered. Print each number entered.

7 Write a structured algorithm to read the scores for a


number of batsmen who played in a cricket match and the
number of extras made by the team. Calculate and output
the total runs made by the team. The data is terminated by
entering 999.

8 Write a structured algorithm which prompts the user to


input the amount of rainfall over a period of days. Calculate
and print the average rainfall. The data is terminated by
9999.

9 A school has two sets A and B. Write a structured


algorithm to read a set and the points awarded for winning
each race in an athletic final terminated by “C”. Calculate
and print the total points gained by each set appropriately
labelled.

10 Data entry for a number of accounts is terminated if the


amount of money being entered exceeds $1000000.00.
Write a structured algorithm to input the amount for each
account and output the total.

You might also like