1.Write a program input two numbers then add two numbers.
a=int(input("enter first number"))
b=int(input("enter second number"))
c=0
c=a+b
print("addition is",c)
2.Write a program input five numbers then multiply them.
a=int(input("enter first number"))
b=int(input("enter second number"))
c=int(input("enter second number"))
d=int(input("enter second number"))
e=int(input("enter second number"))
f=0
f=a*b*c*d*e
print("mul is",f)
3.Write a program input five numbers then multiply then show addition and average.
a=float(input("enter first number"))
b=float(input("enter second number"))
c=float(input("enter second number"))
d=float(input("enter second number"))
e=float(input("enter second number"))
sum=0
avg=0
sum=a+b+c+d+e
avg=sum/6
print("sum is",sum)
print("average is",avg)
4.calculate simple interest
#simple interest
p=float(input("enter the principal"))
t=float(input("enter the time"))
r=float(input("enter the rate"))
si=0
si=p*t*r/100
print("simple interest is",si)
5.Swapping of two numbers.
a=int(input("enter first number"))
b=int(input("enter second number"))
print("before swapping the value of a and b is",a,b)
a=a+b
b=a-b
a=a-b
print("after swapping the value of a and b is",a,b)
6.convert dollar to rupees.
d=float(input("enter dollar amount"))
r=0
r=d*79
print("rupee is",r)
No comments:
Post a Comment