Write a program that requests the user to enter two numbers and prints the sum, product, difference and quotient of the two numbers.

What will be an ideal response?


```
# Using the arithmetic operators.

print "Enter two integers, and I will output their sum,"
print "product, difference and quotient."

# convert the input strings to integers
number1 = raw_input( "Please enter first integer: " )
number1 = int( number1 )

number2 = raw_input( "Please enter second integer: " )
number2 = int( number2 )

print "%d is the sum of %d and %d" \
% ( number1 + number2, number1, number2 )

print "%d is the product of %d and %d" \
% ( number1 * number2, number1, number2 )

print "%d is the difference between %d and %d" \
% ( number1 - number2, number1, number2 )

print "%d is the quotient of %d and %d" \
% ( number1 / number2, number1, number2 )
```
Please enter first integer: 18
Please enter second integer: 6
24 is the sum of 18 and 6
108 is the product of 18 and 6
12 is the difference between 18 and 6
3 is the quotient of 18 and 6

Computer Science & Information Technology

You might also like to view...

A nested if construction in which each nested if is written in the same line as the previous else is called an if-else chain, and is used extensively in many programming problems.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

A table is in third normal form if it is in second normal form and no nonkey column is dependent on only a portion of the primary key.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The ________ Act passed by the U.S. Congress in 1986 made it a crime to access classified information.

A) USA PATRIOT B) Cyber Security Enhancement C) Computer Fraud and Abuse D) Cybersecurity

Computer Science & Information Technology

The general syntax of a step pattern is _____.

A. ?axis::predicate[node-test] B. ?axis[node-test::predicate] C. ?axis::node-test[predicate] D. ?axis[predicate::node-test]

Computer Science & Information Technology