Physics
Physics
MDM-101
Lab Report-01
Code:
x=float(input("1st number: "))
y=float(input("2nd number: "))
z=float(input("3rd number: "))
sum=x+y+z
average=sum/3
print("the average is " , average )
Output:
.Write a python program to calculate the area of a triangle using
3
½*base*height:
Code:
x=float(input("Enter base of the triangle: "))
y=float(input("Enter height of the triangle:"))
area=0.5*x*y
print("the area of the triangle is=" , area)
Output:
4.Write a python program to calculate the area of a triangle
using three sides:
Code:
x = float(input("Enter the first side of the triangle: "))
y = float(input("Enter the second side of the triangle "))
z = float(input("Enter the trird side of the triangle "))
s = (x+y+z)/2
area = (s*(s-x)*(s-y)*(s-z))
print("the area of the triangle is = " , area)
Output:
5.Write a python program to calculate the area of a rectangle:
Code:
length = float(input("Enter the length: "))
width = float(input("Enter width: "))
area= length*width
print("the area of the rectangle is = " , area)
Output:
6.Write a python program to calculate the area of a circle:
Code:
radious = float(input("Enter the radious: "))
area= 3.1416*radious*radious
print("the area of the rectangle is = " , area)
Output:
.write a python program to convert Celsius temperature to
7
Fahrenheit temperature:
Code:
c=float(input("temperature in celsius: "))
temparature_farenhite=(c*(9/5))+32
print("temperature in Fahrenheit is = " , temparature_farenhite)
Output:
..write a python program to convert Fahrenheit temperature
8
to Celsius temperature :
Code:
f=float(input("temperature in fahrenheit: "))
temparature_celcius=(f-32)*(5/9)
print("temperature in Celsius is = " , temparature_celcius)
Output:
9.Write a python program to swap two numbers:
Code:
x=int(input("Enter 1st number:"))
y=int(input("Enter 2nd number:"))
x,y=y,x
print("1st number is" ,x)
print("2nd number is" ,y)
Output :
0.Write a python program to ceil , round and floor a
1
floating-point number:
Code:
Output: