Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 72 - 2632_CodeMind
P. 72

    Example 4: Write an algorithm and draw a flowchart to calculate the factorial of a number.

                                     Algorithm:                                Flowchart:
                     Step 1   Start.
                                                                                  Start
                     Step 2   Read the number N.
                                                                                 Read N
                     Step 3   Let I=1, FACT=1

                     Step 4    Check If I < = N Then Repeat Step
                                                                             I = 1, Fact = 1
                              5 and 6 until I=N

                     Step 5   FACT=FACT*I
                                                                                   If         No
                     Step 6   I=I+1                                              I < = N

                     Step 7   Print FACT                                              Yes

                     Step 8   End.                                           FACT = FACT*I
                                                                                                        Print FACT

                                                                                I = I + 1

                                                                                  Stop

                                                                                          Critical Thinking
                           code Quest                                                     Information Literacy

                          Write an algorithm to calculate the area of a triangle.

                     Mind Map

                     A  Mind  Map  is  also  a  problem-solving  technique  that  allows  us  to  organise  ideas,  thoughts  or
                     concepts and their relationship in a graphical manner.
                     In this technique, we pick up the ideas that have common features. These ideas are then grouped
                     under  one  category,  and  the  different  categories  are  linked  to  the  main  topic  using  lines  or
                     arrows.

                                                                                         Algorithmic Intelligence  71

| 67 68 69 70 71 72 73 74 75 76 77 |