0% found this document useful (0 votes)
16 views

Python

The document contains 12 programming problems to calculate areas and volumes of different shapes like rectangle, triangle, circle and sphere. It also contains programs to calculate percentage, quotient, remainder, simple interest and compound interest.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Python

The document contains 12 programming problems to calculate areas and volumes of different shapes like rectangle, triangle, circle and sphere. It also contains programs to calculate percentage, quotient, remainder, simple interest and compound interest.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Piysuh Deshmukh

Assignment 1

1. Write a program to calculate the percentage of student based on marks of any 5 subjects.

a=int(input('enter 1st sub marks '))


b=int(input('enter 2st sub marks '))
c=int(input('enter 3st sub marks '))
d=int(input('entesr 4st sub marks '))
e=int(input('enter 5st sub marks '))

per=(s/500)*100
print(per)

output enter 1st sub marks 98


enter 2st sub marks 90
enter 3st sub marks 100
entesr 4st sub marks 98
enter 5st sub marks 97
483
96.6

2. Write a program to calculate area of rectangle based on length and breadth.

length = int(input("length of the rectangle: "))


breadth = int(input("breadth of the rectangle: "))

area = length * breadth

print("Area of the rectangle:", area)

length of the rectangle: 10


breadth of the rectangle: 20
Area of the rectangle: 200

3. Program to find quotient and remainder of two numbers.

numerator = int(input("Enter the numerator: "))


denominator = int(input("Enter the denominator: "))

quotient = numerator // denominator


remainder = numerator % denominator

print("Quotient:", quotient)
print("Remainder:", remainder)

Enter the numerator: 10


Enter the denominator: 5
Quotient: 2
Remainder: 0

4. Write a program to enter P, T, R and calculate simple Interest

# Simple Interest
principal = float(input("Enter the principal amount: "))
time = float(input("Enter the time: "))
rate = float(input("Enter the rate of interest: "))

simple_interest = (principal * time * rate)

print("Simple Interest:", simple_interest)


Enter the principal amount: 34
Enter the time: 34
Enter the rate of interest: 43
Simple Interest: 49708.0

5. Write a program to enter P, T, R and calculate Compound Interest

# Compund Interest
P = float(input("principal amount : "))
R = float(input(" annual interest : "))
T = float(input("Enter the time period in years (T): "))

A = P * (1 + R) ** T
CI = A - P

print(f"Compound Interest (CI) is: {CI:.2f}")

Enter the principal amount (P): 24


Enter the annual interest rate (R as a decimal): 56
Enter the time period in years (T): 34
Compound Interest (CI) is: 12021435609957922923174808351374552537617570415588857815760896.00

6. Write a Program to input two angles from user and find third angle of the triangle.

angle1 = float(input("first angle: "))


angle2 = float(input("second angle: "))
angle3 = 180 - (angle1 + angle2)

print("The third angle of the triangle is", angle3)

first angle: 45
second angle: 45
The third angle of the triangle is 90.0

7. Program to Find the Roots of a Quadratic Equation.

a = float(input("coefficient 'a': "))


b = float(input("coefficient 'b': "))
c = float(input("coefficient 'c': "))

d = b**2 - 4*a*c

root1 = (-b + d**0.5) / (2*a)


root2 = (-b - d**0.5) / (2*a)

print("Root 1:", root1)


print("Root 2:", root2)

coefficient 'a': 566


coefficient 'b': 566
coefficient 'c': 655
Root 1: (-0.4999999999999999+0.9524934730770689j)
Root 2: (-0.5000000000000001-0.9524934730770689j)

8. Write a program to convert days into years, weeks and days.

days = int(input("number of days: "))


years = days // 365
weeks = (days % 365) // 7
remaining_days = days % 7
print("Years:", years, "Weeks:", weeks, "Days:", remaining_days)

number of days: 34
Years: 0 Weeks: 4 Days: 6
9. Write a program to enter base and height of a triangle and find its area.

base = int(input("Enter the base of the triangle: "))


height = int(input("Enter the height of the triangle: "))

area = 0.5 * base * height


print(f"The area of the triangle",area)

Enter the base of the triangle: 4


Enter the height of the triangle: 5
The area of the triangle 10.0

10. Write a program to calculate area of an equilateral triangle.

side_length = int(input("side length: "))


area = (3**0.5 / 4) * side_length**2
print("Area:", area)

Enter the side length of the equilateral triangle: 45


Area of the equilateral triangle: 876.8507213317441

11. Find the area and circumference of circle.

radius = float(input("radius of the circle: "))


area = 3.14 * radius**2
circumference = 2 * 3.14 * radius
print("Area:", area)
print("Circumference:", circumference)

radius of the circle: 23


Area: 1661.0600000000002
Circumference: 144.44

12. Find the volume of sphere.

# Program to Find the Volume of a Sphere


radius = float(input("radius: "))
volume = (4/3) * 3.14 * radius**3
print("Volume:", volume)

radius: 34
Volume: 164552.74666666667

You might also like