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

202 Diya Exp1 9l9vMjxsEK

Uploaded by

singhnothing520
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)
3 views2 pages

202 Diya Exp1 9l9vMjxsEK

Uploaded by

singhnothing520
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
You are on page 1/ 2

202_diya_exp1 file:///C:/Users/student/Downloads/202_diya_exp1(1).

html

In [ ]: # DIYA A202 BTECH IT D1

In [8]: a=int(input("enter a number"))


print("square=", a**2)
print("cube=", a**3)
print("square root=", a**0.5)

enter a number5
square= 25
cube= 125
square root= 2.23606797749979

In [11]: a=int(input("enter a number"))


b=int(input("enter a number"))
c=int(input("enter a number"))
print("avg=",(a+b+c)/3)

enter a number1
enter a number2
enter a number3
avg= 2.0

In [14]: b=int(input("enter base"))


h=int(input("enter height"))
print("area=", (b*h)/2)

enter base4
enter height5
area= 10.0

In [16]: p=int(input("enter principle amount"))


r=int(input("enter rate"))
t=int(input("enter time"))
print("si=", (p*r*t/100))

enter principle amount50


enter rate60
enter time70
si= 2100.0

In [20]: f=float(input("enter temp in farenheit="))


print("celsius=",32+(f*4)/5)

enter temp in farenheit=34.5


celsius= 59.6

In [25]: x1=float(input("enter x1 coordinate="))


y1=float(input("enter y1 coordinate="))
x2=float(input("enter x2 coordinate="))
y2=float(input("enter y2 coordinate="))
print("euclidean distance=",((x2-x1)**2+(y2-y1)**2)**0.5)

enter x1 coordinate=3
enter y1 coordinate=4
enter x2 coordinate=6
enter y2 coordinate=8
euclidean distance= 5.0

1 of 2 20-12-2023, 11:56
202_diya_exp1 file:///C:/Users/student/Downloads/202_diya_exp1(1).html

In [28]: x=float(input("enter value of x="))


y=float(input("enter value of y="))
a=x
x=y
y=a
print("x=", x)
print("y=", y)

enter value of x=4


enter value of y=5
x= 5.0
y= 4.0

In [33]: x=float(input("enter value of x="))


y=float(input("enter value of y="))
x,y=y,x
print("x=", x)
print("y=", y)

enter value of x=5


enter value of y=6
x= 6.0
y= 5.0

In [35]: a=float(input("enter coefficient of a="))


b=float(input("enter coefficient of b="))
c=float(input("enter coefficient of c="))
d=b*b-(4*a*c)
print("d=",d)
r1=((-b)+(d**0.5))/(2*a)
r2=((-b)-(d**0.5))/(2*a)
print("root 1=", r1)
print("root 2=", r2)

enter coefficient of a=2


enter coefficient of b=-3
enter coefficient of c=1
d= 1.0
root 1= 1.0
root 2= 0.5

In [ ]:

2 of 2 20-12-2023, 11:56

You might also like