Practcal No.3

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Name: Pranali Govande Class: CO6I

Roll No.:15
1.Write a program to convert U.S. dollars to Indian rupees.
dollars = float(input("Please enter dollars:"))
rupees = dollars * 71
print(rupees, " Rupees")

3.Write a program to find square root of a number.


number = int(input("enter a number: "))
sqrt = number ** 0.5
print("square root:", sqrt)
4.Write a program to find area of Rectangle.
l=int(input("Length : "))
w=int(input("Width : "))
area=l*w
perimeter=2*(l+w)
print("Area of Rectangle : ",area)
print("Perimeter of Rectangle : ",perimeter)
5.Write a program to calculate area and perimeter of the square.
s=int(input("Side : "))
area=s*s
perimeter=4*s
print("Area of Square : ",area)
print("Perimeter of square : ",perimeter)
6.Write a program to calculate surface volume and area of a
cylinder.
import math
r=float(input("Enter r of a cylinde:"))
h=float(input("Enter the Height of a cylinde:"))
s_area=2*math.pi*pow(r,2)*h
volume=math.pi*pow(r,2)*h
print("surface area of a cylinder wll be %.2f" %s_area)
print("volume of a cylinder will be %.2f" %volume)
7.Write a program to swap the value of two variables.
# To take inputs from the user
x = input('Enter value of x: ')
y = input('Enter value of y: ')
# create a temporary variable and swap the values
temp = x
x=y
y = temp
print('The value of x after swapping: {}'.format(x))
print('The value of y after swapping: {}'.format(y))

You might also like