ENGN 38

Solution

Lab Programming Assignment #1

   

// Student Number 13
// Kaufmyn, Wendy
// ENGN 38
// Lab #1                         

// This program inputs two integer values from the keyboard. 
// It then performs three arithmetic operations on the two data values.
// Finally it outputs all the values to the screen.
 

#include "stdafx.h"
#include <iostream>
using namespace std; 

int main ()
{
      int   firstNumber,
            secondNumber,
            sum,
            difference,
            product,
            quotient,
            remainder;     

 
     
cout <<  "\nWelcome to the Arithematic Program.";
      cout <<  "\nChoose two interger values to play around with.";

      cout <<  "\nEnter the first number: ";
      cin  >> firstNumber;

      cout << "Enter the second number: ";
      cin  >> secondNumber;
     

      sum        =  firstNumber + secondNumber;
      difference =  firstNumber - secondNumber;
      product    = firstNumber * secondNumber;
      quotient   =  firstNumber / secondNumber;
      remainder  = firstNumber % secondNumber;     

      cout << "\nData values are: ";
      cout << firstNumber <<" and " <<secondNumber<<"\n\n";     

      cout << "Computed values are:";
      cout << "\nSum.........." <<sum;
      cout << "\nDifference..." <<difference;
      cout << "\nProduct......" << product;
      cout << "\nQuotient....." <<quotient;
      cout << "\nRemainder...." << remainder; 

      cout << "\n\nEnd of Arithmetic Program\n"; 

      return 0;
}

OUTPUT

Welcome to the Arithematic Program.
Choose two interger values to play around with.
Enter the first number: 45
Enter the second number: 6

Data values are: 45 and 6

Computed values are:
Sum..........51
Difference...39
Product......270
Quotient.....7
Remainder....3

End of Arithmetic Program