0% found this document useful (0 votes)
13 views2 pages

Python Programs for Basic Calculations

The document contains a series of Python programs that perform various mathematical calculations. These include finding the sum, difference, and product of two numbers, calculating the area and perimeter of rectangles and squares, determining the area and circumference of circles, converting temperatures, distances, and weights, and calculating simple interest. Each program prompts the user for input and displays the results accordingly.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Python Programs for Basic Calculations

The document contains a series of Python programs that perform various mathematical calculations. These include finding the sum, difference, and product of two numbers, calculating the area and perimeter of rectangles and squares, determining the area and circumference of circles, converting temperatures, distances, and weights, and calculating simple interest. Each program prompts the user for input and displays the results accordingly.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1) Write a Python program to find Sum, Difference and Product of two numbers entered by user.

a = int(input("Enter first number: "))


b = int(input("Enter second number: "))
sum = a + b
difference = a - b
product = a * b
print("Sum is =", sum)
print("Difference =", difference)
print("Product =", product)

2) Write a Python program to find Area and Perimeter of Rectangle.


length = float(input("Enter length of rectangle: "))
breadth = float(input("Enter breadth of rectangle: "))
area = length * breadth
perimeter = 2 * (length + breadth)
print("Area of Rectangle =", area)
print("Perimeter of Rectangle =", perimeter)

3) Write a Python program to find Area and Perimeter of Square.


Side = float(input("Enter the Side of Square: "))
area = Side * Side
perimeter = 4 * Side
print("Area of Square =", area)
print("Perimeter of Square =", perimeter)

4) Write a Python program to find Area and Circumference of Circle.

r = float(input("Enter the Radius of Circle: "))


area = 3.14*r*r
Circumference = 2*3.14*r
print("Area of Circle =", area)
print("Circumference of Circle =", Circumference)

5) Write a Python program to find the power of one number to the other and store the result in
a variable.

b = int(input("Enter number in base: "))


p = int(input("Enter number in power: "))

Solution=b**p
print(“Solution is =", Solution)
6) Write a Python program to convert the value of a given temperature from Fahrenheit to
Celsius. Given C=(F − 32) × 5/9

F = float(input("Enter temperature in Fahrenheit: "))


C=(F − 32) *5/9
print(“Temperature in Celsius =", C)
7)
8) Write a Python program to convert a given distance from Kilometers to Centimeter.

K = float(input("Enter distance in Kilometers: "))


C=K*100000
print(“Distance in Centimeter =", C)

9) Write a Python program to convert a given weight from Kilogram to Gram.

K = float(input("Enter Weight in Kilogram : "))


G=K*1000
print(“Weight in Gram =", G)
10) Write a Python Program to find Simple Interest. Given SI=(P*R*T)/100

P = float(input("Enter the Principal amount: "))


R = float(input ("Enter the Rate of Interest: "))
T= float(input("Enter the Time: "))
SI=(P*R*T)/100
print("Simple Interest is =", SI)

You might also like