Page 37 - IT_V5.0_Class6
P. 37

MORE ALGORITHMS

                 Problem 8: Write an algorithm to input your favourite colour and display a message.
                 Step 1:  Start
                 Step 2:  Input Colour.

                 Step 3:  Print “Your Favourite colour is”, Colour.
                 Step 4:  Stop
                 Problem 9: Write an algorithm to input your pet's name and display a message.
                 Step 1:  Start

                 Step 2:  Ask the user to input their pet's name.
                 Step 3:  Store the pet's name in a variable.
                 Step 4:  Print "Your pet's name is”, PetName.
                 Step 5:  Stop

                 Problem 10: Write an algorithm to input the lengths of three sides of a triangle, calculate and
                 display the perimeter of Triangle.
                 (Hint: Perimeter= Side1+Side2+Side3)
                 Step 1:  Start

                 Step 2:  Input Side1.
                 Step 3:  Input Side2.
                 Step 4:  Input Side3.
                 Step 5:  Calculate Perimeter=Side1+Side2+Side3.

                 Step 6:  Print Perimeter.
                 Step 7:  Stop
                 Problem 11: Write an algorithm to input the NAME and AGE from the user and display if they
                 are minor or adult.
                 The desired output will be:

                    If AGE is greater than 18, display Adult
                    If AGE is less than 18, display Minor
                 The algorithm will be:

                 Step 1:  Start
                 Step 2:  Input NAME.
                 Step 3:  Input AGE.
                 Step 4:  IF AGE > 18 THEN

                                Print NAME, “Adult”.
                 Step 5:  ELSE
                                Print NAME, ”Minor”.
                 Step 6:  Stop








                                                                                       Algorithm and Flowchart   35
   32   33   34   35   36   37   38   39   40   41   42