Page 283 - Artificial Intellegence_v2.0_Class_9
P. 283

Task



                 Do you think of any other way of making a different kind of sandwich? If yes, write the steps in the form
                 of an algorithm .














            Let us look at some examples of algorithm.

            1.  Input the temperature in Fahrenheit and convert it into Celsius and display it.
               Start
               Input Temp in Fahrenheit
               C=5/9*(Temp-32)
               Display C
               Stop
            2.  Input the radius of a circle and calculate its area.
               Start
               Input radius
               Area=3.14*radius*radius
               Display Area
               Stop
            3.  Input an age and check whether eligible for driving licence or not.

               Start
               Input Age
               If the Age is more than or equal to 18 then
               Display " Eligible"
               Otherwise
               Display " Not Eligible"
               Stop
            4.  Display even numbers from 2 to 20.
               Start
               N=2
               Repeat for N is less than or equal to 20

               Display N
               N=N+2
               Goto repeat till N reaches 20
               Stop




                                                                                   Introduction to Python  281
   278   279   280   281   282   283   284   285   286   287   288