You are on page 1of 6

For Loop Activity

Subject: Information Technology


Teacher: Ms. Kera Thompson-Ritchie
Due Date: October 5, 2021
Date Given: October 5, 2021
Group Members
1. Zachary Abrahams
2. Tarun Balachandar
3. Natalia Bennett
4. Kyle Brown
5. Kymani Douglas
6. Akua Latty (Absent)
1. Write a pseudocode algorithm to accept from the user fifteen integer
numbers. Count the number of times six was entered as a number. Print
the number of times six was entered.

Header To count the number of times six was entered


Declare num as integer
Num_six as integer
Start
Num_six ← 0
For counter ← 1 to 15 do
Print "Enter number"
read num
If num=6 then
Num_six ← Num_six + 1
Else
Print “Number not recorded”
Endfor
Print “The number of times six was entered as a number is” Num_six
Stop
2. Write a pseudocode algorithm to accept the favourite colour of ten
persons. Count the number of times red and green was entered. Print
the number of times red and green was entered.

Header To count the number of time red and green was entered
Declare Colour as String
Num_Green as Integer
Num_Red as Integer
START
Num_Green ← 0
Num_Red ← 0
For counter ← 1 to 10 do
Print “Enter your favourite colour”
Read Colour
If Colour=”Green” then
Num_Green←Num_Green + 1
Elseif Colour=”Red” then
Num_Red←Num_Red + 1
Else
Print “Not recorded”
Endfor
Print “The number of times green was counted is”, Num_Green
Print “The number of times red was counted is”, Num_Red
STOP
3. A pseudocode algorithm that asks the user for the number of persons
within a group. For each person it requests the person’s first name and
last name, and then prints out the full name with a message.

Header Recording the number of people in a group and their names


Declare num1 as real
person_name as string

START
Print “Enter the number of people in your group”
Read num1
For counter ←1 to num1 do
Print “Enter your first name and last name”
Read person_name
Print “Hello”, person_name, “Welcome”
Endfor
STOP
4. Write a pseudocode algorithm that reads in N numbers and keeps a
running total of their sum as it reads them. The value of N is to be
supplied by the user.

Header Adding Numbers continuously


Declare N as integer
Sum as Real
Num as Real

START
Sum ← 0
Print “How many numbers would you like to calculate?”
Read N
For counter ← 1 to N do
Print “Enter Number”
Read num
Sum ← Sum + num
Endfor
Print “The total numbers used are” N
Print “The total of all numbers is” Sum
STOP
5. Write an algorithm that will find the largest of a series of 100 numbers.
Print the largest of all the numbers entered.

Header Finding The Largest Number In A Series.


Declare num1 as Real
num2 as Real
Largest as Real
Number as Real

START
Print “Enter 2 numbers”
Read num1
Read num2
If num1 >= num2 then
Largest ← num1
Elseif num1 < num2 then
Largest ← num2
Else
Print “Invalid”
For counter ← 1 to 100 do
Print “Enter 98 numbers”
Read number
If number >= Largest then
Largest ← number
Elseif number< Largest then
Print “Not large enough”
Else
Print “Invalid”
Endfor
Print “The Largest number is”, Largest
STOP

You might also like