Page 401 - Ai_417_V3.0_C9_Flipbook
P. 401

Flowchart

                                                   START


                                                   Input
                                                Amount, Age




                                                     Is      No            Display
                                                 Amount >            "Sorry! No Discount"
                                                   10000?

                                                      Yes


                                                     Is      No             Display
                                                Age >= 60?       Amount = Amount-(0.10*Amount)


                                                      Yes
                                                 Display
                                      Amount = Amount-(0.15*Amount)



                                                    STOP

                 Source Code:

                 Amount=float(input("Enter Billing Amount: Rs. "))
                 Age=int(input("Enter Age: "))
                 if Amount > 10000:
                     if Age >= 60:
                         print("Final billing amount after 15 % discount: Rs. ",Amount-(0.15*Amount))
                     else:

                         print("Final billing amount after 10 % discount: Rs. ",Amount-(0.10*Amount))
                 else:
                     print("Sorry! No Discount")
                 Output:

                 Enter Billing Amount: Rs. 15000
                 Enter Age: 61

                 Final billing amount after 15 % discount: Rs. 12750.0
                  Program 10:  To input a number and check whether it is multiple of 5 or not. This check is valid only for

                  positive numbers.
                 Algorithm

                 Step 1   Start
                 Step 2   Input Num
                 Step 3   if Num is greater than zero then


                                                                                        Introduction to Python  399
   396   397   398   399   400   401   402   403   404   405   406