#WAP in Python to create a calculator
a=int(input("Enter First Number: "))
b=int(input("Enter Second Number: "))
sum=a+b
sub=a-b
pro=a*b
div=a/b
fdiv=a//b
exp=a**b
rem=a%b
print("Sum=",sum)
print("Difference=",sub)
print("Product=",pro)
print("Division=",div)
print("Floor Division=",fdiv)
print("Exponational=",exp)
print("Modulus=",rem)
Output
Enter First Number: 22
Enter Second Number: 5
Sum= 27
Difference= 17
Product= 110
Division= 4.4
Floor Division= 4
Exponational= 5153632
Modulus= 2
2.
#WAP in Python to calculate simple interest
P=float(input("Enter the principal amount: "))
R=float(input("Enter rate of interest Yearly: "))
T=int(input("Enter the number of year: "))
SI=P*R*T/100
print("Simple Interest=",SI)
Output:
Enter the principal amount: 5000
Enter rate of interest Yearly: 24
Enter the number of year: 5
Simple Interest= 6000.0
No comments:
Post a Comment