LAB 2

Programming

This program will prompt the user for two integer numbers (numbers without decimal points). it will next display the following output:

  • First Line: the sum of the first and second number
  • Second Line: the result of subtracting the second number from the first
  • Third Line: the product of the first and the second number
  • Fourth Line: the integer division of the first number by the second number, followed by the remainder from dividing the first number by the second number

Source Code:

inputStr1 = raw_input(‘Please enter the first integer number: ‘)
inputInt1 = int(inputStr1)
inputStr2 = raw_input(‘Please enter the second integer number: ‘)
inputInt2 = int(inputStr2)
print
print
print ‘The Sum of’,inputInt1,’ and ‘,inputInt2,’ is: ‘,inputInt1 + inputInt2
print
print ‘The Difference of’,inputInt1,’ and ‘,inputInt2,’ is: ‘,inputInt1 – inputInt2
print
print ‘The Product of’,inputInt1,’ and ‘,inputInt2,’ is: ‘,inputInt1 * inputInt2
print
print ‘The Quotient of’,inputInt1,’ and ‘,inputInt2,’ is: ‘,inputInt1 / inputInt2,’ with remainder: ‘,inputInt1 % inputInt2

Output: