...
Calculate Area of Rectangle:
pythonlength = float(input("Enter the length of the rectangle: ")) breadth = float(input("Enter the breadth of the rectangle: ")) area = length * breadth print(f"The area of the rectangle is {area}")
Calculate Area of Circle:
pythonimport math radius = float(input("Enter the radius of the circle: ")) area = math.pi * (radius ** 2) print(f"The area of the circle is {area}")
Calculate Total and Percentage of Marks:
pythonname = input("Enter the student's name: ") marks = [] for i in range(5): mark = float(input(f"Enter the mark for subject {i+1}: ")) marks.append(mark) total = sum(marks) percentage = (total / 500) * 100 print(f"Total marks: {total}") print(f"Percentage: {percentage}%")
Convert Feet to Inches:
pythonfeet = float(input("Enter the distance in feet: ")) inches = feet * 12 print(f"The distance in inches is {inches}")
Convert Fahrenheit to Celsius:
pythonfahrenheit = float(input("Enter temperature in Fahrenheit: ")) celsius = (fahrenheit - 32) * 5/9 print(f"The temperature in Celsius is {celsius}")
Calculate Volume of Cylinder:
pythonimport math radius = float(input("Enter the radius of the cylinder: ")) height = float(input("Enter the height of the cylinder: ")) volume = math.pi * (radius ** 2) * height print(f"The volume of the cylinder is {volume}")
You can run these programs individually depending on which task you want to perform.
No comments:
Post a Comment