Arithmetic Operations program and use of format()

 

 Arithmetic Operations program and use of format()

number1=int(input("Enter first value"))

number2=float(input("Enter second number"))

print("Entered number is:",number1)

print("Entered second number is:",number2)

sum1=number1+number2

print("The sum of {0} and {1} is {2}".format(number1,number2,sum1))

sub=number1-number2

print("The substraction of {0} and {1} is {2}".format(number1,number2,sub))

product=number1*number2

print("The product of {0} and {1} is {2}".format(number1,number2,product))

rem=number1/number2

print("The division of {0} and {1} is {2}".format(number1,number2,rem))

Output:

Enter first value150

Enter second number20000

Entered number is: 150

Entered second number is: 20000.0

The sum of 150 and 20000.0 is 20150.0

The substraction of 150 and 20000.0 is -19850.0

The product of 150 and 20000.0 is 3000000.0

The division of 150 and 20000.0 is 0.0075

टिप्पणी पोस्ट करा

0 टिप्पण्या