118k views
23 votes
Write a pseudocode algorithm which asks the user to enter their favourite colour. It then calls a subroutine which accepts the colour as a parameter and prints out a suitable comment.

For example, if the user enters “Green” for their favourite colour, print “OK, Green is good…”) or any comment of your choice.
Test for at least 3 colours. If the colour is not one of these three, print a different comment
- e.g. “Strange!” [5]

User Diego Lara
by
4.6k points

1 Answer

14 votes

Answer:

START

DISPLAY " ENTER YOUR FAVORITE COLOR"

INPUT FAV COLOR

CALL FUNC PRINT COMMENT( FAV COLOR):

IF FAV COLOR == RED:

DISPLAY "YOU CHOOSE THE BEST COLOR"

IF FAV COLOR == ORANGE:

DISPLAY "YOU CHOOSE THE SECOND BEST COLOR"

IF FAV COLOR == YELLOW:

DISPLAY "YOU CHOOSE THE THIRD BEST COLOR"

END

Step-by-step explanation:

Remember Pseudo codes are the code that can be easily converted to programming language keywords. Or in other words, its easy to make a computer program out of them, like in the above display can be converted to print in python and so on.

User Cronfy
by
4.8k points