Selection and Iteration exercise

Task: Create a solution which accepts 10 temperatures in Celsius and outputs “it is hot” if the temperature is greater than 30 degrees, otherwise output “it is cold”

Solution

See flowgorithm files here:

https://drive.google.com/drive/folders/1lvuR4sNPoV8ZfWN_GPL1DnZewjNm3bES?usp=sharing

Flowchart

Source: https://upload.wikimedia.org/wikipedia/commons/3/3a/Looping_and_Selection_Exercise.png

Pseudocode

Start
    // Task: Create a solution which accepts 10 temperatures in Celsius and outputs "it is hot" if the temperature is greater than 30 degrees, otherwise output "it is cold"
    // 
    // Start Declaring Variables
    // End Declaring Variables
    // Start Variable Initialization
    // 
    counter = 1
    maximum = 10
    currentTemperature = -999.99
    
    // End Variable Initialization
    // 
    loop while counter <= maximum
        output "Please enter temperature value #" + counter
        input currentTemperature
        if currentTemperature > 30 then
            output "it is hot"
        else
            output "it is cold"
        end If
        counter = counter + 1
    end while
    output "Ending program"
end 

© 2022  Vedesh Kungebeharry. All rights reserved. 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s