top of page

ALGORITHM A  DAY- HOT!

Below are a list of excerices to help you create an algorithm for a problem. There are two types of algorithm

HOT! Algorithm A Day 1

Write an algorithm in pseudocode which: - asks the user to input 2 numbers - outputs the larger of the two numbers along with a suitable message [5 marks] 

Please complete on paper or submit via Edmodo

HOT! Algorithm A Day 2

If Monday = 0, Tuesday = 1 etc… 
 
…write an algorithm in pseudocode which:

- Asks the user to enter a number,

- Outputs the day that the number represents,

- Validates the number so that an error message displays if the number is not a valid weekday number.  [5 marks]

Please complete on paper or submit via Edmodo

 

HOT! Algorithm A Day 3

A program has been written to obtain 3 random virtual dice rolls: 
 
DiceRoll(1) = Random Number 1-6

DiceRoll(2) = Random Number 1-6

DiceRoll(3) = Random Number 1-6

DISPLAY DiceRoll(1)

DISPLAY DiceRoll(2)

DISPLAY DiceRoll(3)  
 
Rewrite this algorithm in pseudocode so that it makes use of iteration.  [4 marks]

Please complete on paper or submit via Edmodo

HOT! Algorithm A Day 4

A dog that is 5 years old is equivalent to a 42 year old human. You need to write a program that converts the age of a dog to the equivalent age of a human.

 

Write an algorithm in pseudocode which:

- Asks for the age of the dog in years

- If the age is 2 or less, the human equivalent is 12 times the age

- If the age is more than 2, the human equivalent is 24 for the first 2 years, plus 6 for every additional year.  [5 marks]

Please complete on paper or submit via Edmodo

HOT! Algorithm A Day 5

Consider the array numbers = [2, 5, 3, 6, 2, 3, 6, 4] where the value of numbers(2) is 3. 
 
Write an algorithm in pseudocode which: - Adds up the numbers in the array - Displays the result. To get full marks a loop should be used in your algorithm.  
 [5 marks] 

Please complete on paper or submit via Edmodo

HOT! Algorithm A Day 6

A taxi firm charges £3 for the first mile and £2 for every mile after that. If there are 5 or more passengers, an extra 50% is added to the price. Write an algorithm in pseudocode which calculates the cost of a journey.

 

The algorithm should:

- Ask the user to enter the number of passengers

- Ask the user to enter the distance (as an integer)

- Calculate the price of the journey

- Output the price on the screen  [7 marks]

Please complete on paper or submit via Edmodo

HOT! Algorithm A Day 7

In a factory, the wages earned by a worker is either £2 for every teddy bear they have made or £5 for every hour they have worked, whichever is higher. 
 
Write an algorithm in pseudocode which:

- Allows the user to input the number of teddy bears made and the number of hours worked

- Calculates the wages for the number of teddy bears made

- Calculates the wages for the number of hours worked

- Outputs the larger of the two results.  [6 marks]

Please complete on paper or submit via Edmodo

HOT! Algorithm A Day 8

An isosceles triangle is one which has at least two equal length sides. 
 
Write an algorithm in pseudocode which:

- Asks the user to enter the lengths of a triangle

- Works out if the triangle is isosceles

- Outputs a message stating whether the triangle is isosceles or not.  [5 marks]

Please complete on paper or submit via Edmodo

HOT! Algorithm A Day 9

A free drinks machine provides 20 different drinks.

The machine has a small keypad with keys 0-9, Submit and Cancel.

It has a small LCD display, which can display messages to the user.

 

To get a drink the user selects it by typing in the relevant number (1-20).

If they type in the wrong number, they can cancel and enter a new number.

When they are happy with their choice they press the submit button.

If the selection is valid (1-20) and the drink available, the machine will dispense the drink.

 

Write an algorithm in pseudocode which for the process outlined above  [6 marks] 

Please complete on paper or submit via Edmodo

HOT! Algorithm A Day 10

Please complete on paper or submit via Edmodo

HOT! Algorithm A Day 11

A display board can show a flashing message of up to 20 characters. 
 

*******WELCOME******
 
Write an algorithm in pseudocode which: - Allows the user to input the message and the number of flashes - Rejects the message if it is longer than 20 characters and stops - Otherwise it repeatedly displays the message and clears the display for the correct number of times.  [5 marks] 

Please complete on paper or submit via Edmodo

HOT! Algorithm A Day 12

 

Please complete on paper or submit via Edmodo

HOT! Algorithm A Day 12- (OCR 20)

MyHotPizza company have developed a new loyalty reward system for customers.  Customers are automatically sent a reward card if they order more than 20 pizzas in a year.

They have a log of customer’s orders stored in a file, as shown:

 

Customer Name        Large              Medium         Small            Card?

Smith, J                           5                             6                 1                No

Williams, P                    10                            12               3                Yes

Write an algorithm (Pseudocode) that goes through the customer orders, and where needed, sends customers a loyalty card if they do not already have one.  If they have not ordered enough pizzas, then it removes them from the card list.

 

HELP: USE......   BEGIN    END   IF   ELSE   ==   -

Please complete on paper or submit via Edmodo

HOT! Algorithm A Day 13- (OCR 21)

A local swimming centre offers the following discounts: 

  1. Members who are aged between 13 and 15 receive a 30% discount.

  2. Members who are aged between 16 and 17 receive a 20% discount.

  3. Members who are aged 50 and over receive a 40% discount.

  4. All other members receive no discount. 

 

Create an algorithm using Pseudocode for the above actions.

 

HELP >>>     > = < =  AND  OR   =   BEGIN / END  INPUT  OUTPUT  IF  ELIF  ELSE

Please complete on paper or submit via Edmodo

HOT! Algorithm A Day 14- (OCR 22)

Write an algorithm that:

  • Asks the user to input how many marks they got on a test.

  • It should then convert this to a grade between 1 to 9 using the table below and then output the grade to the user. If they have not scored enough to be given a grade than a ‘U’ grade must be output.

 

Mark                                                Grade

Greater than or equal to 10             1

Greater than or equal to 20             2

Greater than or equal to 30              3

 

HELP >>>  >=  <  AND  =   BEGIN / END   INPUT    OUTPUT  IF  ELIF   ELSE   ==   -

Please complete on paper or submit via Edmodo

AlgoADay_edited.jpg
AlgoADay3.png
bottom of page