Page 268 - Ai_V1.0_Class9
P. 268

S. No.                                          Program

                    9     To calculate Area of a triangle with Base and Height

                          Base=int(input("Enter Base : "))
                          Height=int(input("Enter Height : "))
                          print("Area of Triangle is : ",(1/2)*Base*Height)
                          Output:
                          Enter Base : 10
                          Enter Height : 15
                          Area of Triangle is : 75.0
                    10    To calculating average marks of 3 subjects

                          Eng=float(input("Enter Eng Marks : "))
                          Maths=float(input("Enter Maths Marks : "))
                          Science=float(input("Enter Science Marks : "))
                          print("Average of 3 subjects is : ",round((Eng+Maths+Science)/3,2))
                          Output:
                          Enter Eng Marks : 90
                          Enter Maths Marks : 95
                          Enter Science Marks : 87
                          Average of 3 subjects is : 90.67
                    11    To calculate discounted amount with discount %
                          Amt=int(input("Enter an Amount : "))

                          Discount=int(input("Enter Discount : "))
                          print("The discounted amount is : ",Amt-Discount)
                          print("The discount % is : ",(Discount/Amt)*100)
                          Output:
                          Enter an Amount : 100
                          Enter Discount : 24
                          The discounted amount is : 76
                          The discount % is : 24.0
                    12    To calculate Surface Area and Volume of a Cuboid

                          Length=int(input("Enter Length : "))
                          Breadth=int(input("Enter Breadth : "))
                          Height=int(input("Enter Height : "))
                          Volume=Length*Breadth*Height
                          print("Volume of Cuboid is : ",Volume)
                          Surface_Area=2*((Length*Breadth)+(Breadth*Height)+(Length*Height))
                          print("Surface Area of Cuboid is : ",Surface_Area)
                          Output:
                          Enter Length : 10
                          Enter Breadth : 8
                          Enter Height : 5
                          Volume of Cuboid is : 400
                          Surface Area of Cuboid is : 340


                    266     Artificial Intelligence Play (Ver 1.0)-IX
   263   264   265   266   267   268   269   270   271   272   273