Write a Python program that prompts a user for two integers and stores the two integers the user types into the shell. Print the product, float division, integer division, remainder, sum, and difference of the two integers to the console. The entire equation must be printed (see below for formatting). Only display 2 digits after the decimal place for results that are floats. Include a module docstring that summarizes the program..
Sample Run 1:
Enter an integer: 5 Enter another integer: 4 5 * 4 = 20 5 / 4 = 1.25 5 // 4 = 1 5 % 4 = 1 5 + 4 = 9 5 - 4 = 1
Sample Run 2:
Enter an integer: 1 Enter another integer: 3 1 * 3 = 3 1 / 3 = 0.33 1 // 3 = 0 1 % 3 = 1 1 + 3 = 4 1 - 3 = -2
SOURCE PROGRAM:
num1=int(input("Enter an integer:"))
num2=int(input("Enter another integer:"))
product=num1*num2
float_div=num1/num2
int_div=num1//num2
rem=num1%num2
add=num1+num2
sub=num1-num2
print(num1,"*",num2,"=",product)
print(num1,"/",num2,"= %.2f "%(float_div))
print(num1,"//",num2,"=",int_div)
print(num1,"%",num2,"=",rem)
print(num1,"+",num2,"=",add)
print(num1,"+",num2,"=",sub)
Note: % .2f means it will print only two decimal points
Sample input and output:
Get Answers For Free
Most questions answered within 1 hours.