#1.
program to calculate area and circumference of a circle
pi=3.14
rad= float(input(“Enter the radius=”))
area=pi*rad*rad
circumference=2*pi*rad
print(“Area of circle=”,area)
print(“Circumference of circle=”,circumference)
# 2. program to calculate area and perimeter of a rectangle
length= float(input(“Enter the length=”))
breadth= float(input(“Enter the breadth=”))
area=length*breadth
perimeter=2*length*breadth
print(“Area of rectangle=”,area)
print(“Perimeter of rectangle=”, perimeter)
# 3. Python program to calculate simple interest
Principle = float(input('Enter principal amount: '))
Rate_of_int = float(input('Enter the interest rate: '))
Time = float(input('Enter time: '))
# calculate simple interest
Simple_int = (Principle * Rate_of_int * Time) / 100
print('Simple interest = ',Simple_int )
#4. Program to perform calculation of different arithmetic operator
f_no=int(input(“Enter the first number”))
s_no=int(input(“Enter the second number”))
#Addition +
add= f_no+ s_no
print(“Addition of given two numbers=”,add)
#Subtraction -
sub= f_no - s_no
print(“Subtraction of given two numbers=”,sub)
#Multiplication *
mul= f_no * s_no
print(“Multiplication of given two numbers=”,mul)
1
#Division / gives result as quotient with decimal point
div= f_no / s_no
print(“Division of given two numbers=”,div)
#Modulus % gives result as remainder
rem= f_no % s_no
print(“Modulus operator of given two numbers=”,rem)
#Floor value // gives result as quotient without decimal point
flr= f_no // s_no
print(“Floor value operator of given two numbers=”,flr)
#Exponent ** gives result as raised to the power
exp= f_no ** s_no
print(“Exponent operator of given two numbers=”,exp)
#5. Program to swap two values
f_no=int(input(“Enter the first number”))
s_no=int(input(“Enter the second number”))
print(“Before swapping first no=”,f_no)
print(“Before swapping second no=”,s_no)
temp=f_no
f_no=s_no
s_no=temp
print(“After swapping first no=”,f_no)
print(“After swapping second no=”,s_no)
# 6. Program to convert celcius to fahrenheit and vice versa
cel=float(input(“Enter the temperature in celcius=”))
fah=cel*1.8+32
print(“Temperature in Fahrenheit=”,fah)
fahren=float(input(“Enter the temperature in fahrenheit=”))
celcius=(fahren-32)/1.8
print(“Temperature in celcius=”,celcius)
2
#7. Program to convert meters to kilometer and vice versa
mtr=float(input(“Enter the meters=”))
km=mtr/1000
print(“Conversion into kilometer=”,km)
kilomtr=float(input(“Enter the kilometer=”))
meter= kilomtr*1000
print(“Conversion into meters=”,meter)
# 8 Python program to calculate your age
import datetime
print(" Age Calculator")
birth_year=int(input("Enter your year of birth:"))
birth_month=int(input("Enter your month of birth:"))
birth_day=int(input("Enter your date of birth:"))
current_year=datetime.date.today().year
current_month=datetime.date.today().month
current_day=datetime.date.today().day
age_year=current_year-birth_year
age_month=current_month-birth_month
age_day=current_day-birth_day
print("Your exact age is:",age_year,"Years",age_month,"Months",age_day,"Days")