Download as DOCX, PDF, TXT or read online from Scribd
Download as docx, pdf, or txt
You are on page 1of 7
Name: Sangram S Supalkar
Branch: TYCO-B Roll-84
Experiment 3 Programs
Q. 1 Write a program to convert U.S. dollars to Indian rupees.
us = int(input("Enter US dollars : ")) indian = us * 71.42 print("Indian Rupees : ", indian) Output Enter US dollars : 3 Indian Rupees : 214.26 Name: Sangram S Supalkar Branch: TYCO-B Roll-84
Q. 2 Write a program to convert bits to Megabytes, Gigabytes and Terabytes.
Q. 3 Write a program to find the square root of a number
import math num = int(input("Enter a number : ")) sqroot = math.sqrt(num) print("Square root of ", num, " is ", sqroot) Output Enter a number : 4 Square root of 4 is 2.0 Name: Sangram S Supalkar Branch: TYCO-B Roll-84
Q.4 Write a program to find the area of Rectangle
l = int(input("Enter Length of rect : ")) b = int(input("Enter width of rect : ")) area = l * b print("Area of rectangle : ", area) Output Enter Length of rect : 4 Enter width of rect : 5 Area of rectangle : 20 Name: Sangram S Supalkar Branch: TYCO-B Roll-84
Q.5 Write a program to calculate area and perimeter of square.
side = int(input("Enter side of a square : ")) area = side * side peri = 4 * side print("Area of square : ", area) print("Perimeter of square : ", peri) Ouput Enter side of a square : 4 Area of square : 16 Perimeter of square : 16 Name: Sangram S Supalkar Branch: TYCO-B Roll-84
Q.6 Write a program to calculate surface volume and area of a cylinder
import math r = int(input("Enter Radius : ")) h = int(input("Enter Height : ")) Sarea = ((2 * math.pi) * (r * r)) + (2 * math.pi) * r * h Svolume = math.pi * (r * r) * h print("Surface Volume of cylinder : {:.2F}".format(Svolume)) print("Surface Area of cylinder {:.2F}".format(Sarea)) Output Enter Radius : 3 Enter Height : 5 Surface Volume of cylinder : 141.37 Surface Area of cylinder 150.80 Name: Sangram S Supalkar Branch: TYCO-B Roll-84
Q. 7 Write a program to swap the value of two variables