Page 192 - Computer Science Class 11 Without Functions
P. 192

Solution:

          01 '''
          02 Objective:
          03         1. Accept the principal and time (in years) from the user
          04         2. Determine the rate of interest (rate) as per rules:
          05            nYears >= 5, @8%,
          06            3 <= nYears <5, @6%, nYears < 3, @4%
          07         3. Compute simple interest
          08 '''
          09 principal = float(input("Enter Principal Amount: "))
          10 nYears = int(input("Enter time period in Years: "))
          11 if nYears < 3:
          12     rate = 4
          13 elif nYears >= 3 and nYears <5:
          14     rate = 6
          15 else:
          16     rate = 8
          17 simpleInterest = (principal * rate * nYears)/100
          18 print("Principal:", principal)
          19 print("Rate of Interest:", rate)
          20 print("Simple Interest:", simpleInterest)

         nepatlOuSpuS:
         >>> Enter Principal Amount: 4000
         >>> Enter time period in Years: 4
              Principal: 4000.0
              Rate of Interest: 6
              Simple Interest: 960.0
         Program  8.10  WriStl nl progrnel ShnSl coepuSttl Shtl neounSl ofl eonShayl tchoanrthipl Sol btl nwnrdtdl Sol nl tSudtnS,l
         bnttdlonlptrctnSngtlnndlnnnunalfneiaylincoet.


                        Percentage                    Annual Income                   Scholarship
               <40                            NoSlnppaicnbat                 Nia
               >=40lnndl<50                   <65000                         2000lptrleonSh
                                              >=65000                        Nia
               >=50lnndl<75                   <65000                         4000lptrleonSh

                                              >=65000                        3000lptrleonSh
               >=75lnndl<=100                 NoSlSolbtlcontidtrtd           5000lptrleonSh

        Solution:
          01 '''
          02 Objective: To find the amount of scholarship
          03 Inputs:
          04         percentage : percentage of marks
          05         annualIncome : Annual Income
          06 Output: scholarship - monthly scholarship amount
          07 '''
          08 percentage = int(input('Enter your percentage: '))
          09 annualIncome = int(input('Enter the annual income: '))
          10 if percentage < 40:
          11     scholarship = 'Nil'
          12 elif percentage >= 40 and percentage<50:
          13     if annualIncome < 65000:
          14         scholarship = 2000

         190   Touchpad Computer Science-XI
   187   188   189   190   191   192   193   194   195   196   197