0% found this document useful (0 votes)
71 views

Sum of Two Numbers: "Welcome"

The document contains Python code snippets for solving various mathematical problems like finding the sum of two numbers, calculating the area and perimeter of a circle, finding the average of three numbers, evaluating expressions by inputting variable values, calculating distance walked around a circular ground, converting Celsius to Fahrenheit, and more. It also includes code for calculating simple and compound interest, finding the biggest number among three inputs, and calculating power of a given value. The code snippets demonstrate how to take inputs, perform calculations, and output results in Python.

Uploaded by

mani maran
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)
71 views

Sum of Two Numbers: "Welcome"

The document contains Python code snippets for solving various mathematical problems like finding the sum of two numbers, calculating the area and perimeter of a circle, finding the average of three numbers, evaluating expressions by inputting variable values, calculating distance walked around a circular ground, converting Celsius to Fahrenheit, and more. It also includes code for calculating simple and compound interest, finding the biggest number among three inputs, and calculating power of a given value. The code snippets demonstrate how to take inputs, perform calculations, and output results in Python.

Uploaded by

mani maran
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/ 4

1/22/2020 2019111048

In [1]:

print("welcome")

welcome

sum of two numbers


In [ ]:

a=int(input(enter the number:"))


b=int(input("enter the number:"))
c=a+b
print("sum=",c)

To find the area and perimeter of a circle


In [ ]:

a=int(input("enter the length:"))


b=int(input("enter the width:"))
c=a*b
d=2*(a+b)
print("Area=",c)
print("perimeter=",d)

To find the average of three numbers


In [8]:

A=int(input("Enter the first no:"))


B=int(input("Enter the second no:"))
C=int(input("Enter the third no:"))
D=(A+B+C)/3
print("Average=",D)

Average= 7.0

Evaluating the expression by getting the values for each


variable

https://jlab.annauniv.edu:8000/user/be2019111048/lab? 1/4
1/22/2020 2019111048

In [10]:

a=int(input("Enter the value:"))


b=int(input("Enter the value:"))
c=int(input("Enter the value:"))
d=int(input("Enter the value:"))
f=int(input("Enter the value:"))
E={(a*b)+(c/d)-f}
print("Answer=",E)

Answer= {10.0}

To find the distance walked by a person around a circular


ground
In [15]:

d=int(input("enter the diameter:"))


pi=3.14
C=pi*d
print("distance=",C)

distance= 31.400000000000002

To calculate the area of the rectangular plot of land in acres


In [16]:

l=int(input("length:"))
b=int(input("breadth:"))
A=l*b*0.000247105
print("Area=",A,"acres")

Area= 24.7105 acres

To demonstrate the arithmetic operations

https://jlab.annauniv.edu:8000/user/be2019111048/lab? 2/4
1/22/2020 2019111048

In [33]:

a=int(input("enter the number"))


b=int(input("enter the number"))
A=a+b
B=a-b
C=a*b
D=a/b
E=a%b
print("The addition value is:",A)
print("The subraction value is:",B)
print("The multplication value is:",c)
print("The division value is:",D)
print("The modulus value is:",E)

The addition value is: 135


The subraction value is: 45
The multplication value is: 15625
The division value is: 2.0
The modulus value is: 0

To convert celsius to fahrenheit


In [18]:

t=int(input("Enter temp in celsius:"))


T=t*1.8+32
print("Temp in fahrenheit=",T,"F")

Temp in fahrenheit= 41.0 F

To find the area of a circle


In [21]:

r=int(input("enter the radius:"))


pi=3.14
A=pi*r**2
print("Area=",A)

Area= 314.0

To find the simple and compound interest

https://jlab.annauniv.edu:8000/user/be2019111048/lab? 3/4
1/22/2020 2019111048

In [32]:

p=int(input("enter the value:"))


n=int(input("enter the value:"))
r=float(input("enter the value:"))
Si=p*n*r/100
amt=p*pow((1+r/100),n)
Ci=amt-p
print("simple interest=",Si)
print("Compound interest=",Ci)

simple interest= 1500.0


Compound interest= 1576.2500000000018

To calculate the power of the given value


In [34]:

a=int(input("enter the first no"))


b=int(input("enter the second no"))
c=a**b
print("Answer=",c)

Answer= 3125

The biggest no among a,b,c


In [40]:

a=int(input("enter the number"))


b=int(input("enter the number"))
c=int(input("enter the number"))
big=a
if(a>big):
big=a
if(b>big):
big=b
if(c>big):
big=c
print("The greatest no is:",big)

The greatest no is: 5555555

In [ ]:

https://jlab.annauniv.edu:8000/user/be2019111048/lab? 4/4

You might also like