Page 105 - Computer science 868 Class 12
P. 105

Let us demonstrate all the three methods with the following simple examples.
                 Question 1: Accept the radius of a circle and calculate its area.
                                                                                          Flowchart:
                 Algorithm:                                                                                   Start
                 Step 1:  Start.
                 Step 2:  Accept the radius in variable R.
                                                                                                            Accept R
                 Step 3:  Calculate Area A as 3.142 × R × R.
                 Step 4:  Display A.
                 Step 5:  Stop.                                                                           A = 3.142 × R × R


                 Pseudocode:
                 Begin
                                                                                                            Display A
                        Read R
                        A         3.142 × R × R
                        Output R                                                                               Stop
                 End

                 Question 2: Accept any number and check whether it is a Buzz number or not. A Buzz number is one that is divisible
                 by 7 or ends with 7.

                 Algorithm:
                 Step 1:  Start.
                                                                    Flowchart:
                 Step 2:  Accept any number in num.                                   Start

                 Step 3:  If num % 7=0 then go to step 5.
                 Step 4:  If num % 10=7 then go to Step 5,else go to Step 7.
                                                                                   Accept num
                 Step 5:   Display num “is a Buzz number”, go to Step 7.
                                                                                    No
                 Step 6:   Display num “is not a Buzz number”.

                 Step 7:  Stop.                                                    Is num%7=0          Yes

                 Pseudocode:
                                                                                     No
                 Begin
                     Read num                                                      Is num%10=7     Yes     Display “Buzz
                                                                                                             number”
                     If num%7 = 0

                         Display “Buzz number”                                       No
                     Else if num%10=7                                              Display “Not
                                                                                  Buzz number”
                          Display, “is a Buzz number”
                     Else
                            “is not a Buzz number”                                    Stop

                 End if
                 End






                                                                                                                       103
                                                                            Implementation of Algorithms to Solve Problems  103
   100   101   102   103   104   105   106   107   108   109   110