All pastes #351510 Raw Edit

Stuff

public text v1 · immutable
·published 2007-02-12 05:43 UTC
rendered paste body
// Program about sum, product, division, and riminder.
 # include <iostream>
 using namespace std;
 int main()
 {
   int num1;  // integers number1.
   int num2;  // integers number2.
   float num3; // float number3.
 
   int sum1;  // sum of the number1 and number2.
   int prod1; // product of the number1 and number2.
   int quot1; // division of the number1 and number2.
   int rmd;   // riminder of the number1 and number2.
   float sum2; // sum of the number1 and number3.
   float prod2; // product of the number1 and number3
   float quot2; // division of the number1 and number3
   cout<< "enter the num1: ";
   cin >> num1;
   cout<< "enter the num2 (> 8): " ;
   cin >> num2 ;
  cout << "num1" << '\t' << "num2" << '\t' << "num3" << '\t' << "sum1" << '\t' $
  '\t' << "quot2" << '\t' << "rmd" << endl;
 
  // THIS IS THE PART OF CALCULATION 

 num3 = num2 * 1.0;
 sum1 = num1+num2 ;
 sum2 = num1+num3 ;
  prod1 = num1*num2 ;
 prod2 = num1*num3 ;
 quot1 = num1/num2 ;
 quot2 = num1/num3 ;
 rmd = num1 % num2 ;
cout << num1 << '\t' << num2 << '\t' << num3 << '\t' << sum1 << '\t' << sum2 <<$m2 << '\t' << prod1 << '\t' << prod2 << '\t'<< quot1 << '\t' << quot2 << '\t' $quot2 << '\t' << rmd << endl;
 num1=num1+5;
 num2=num2-4;
// PART OF CALCULATION ENDS HERE

  
//  What happen if you repeat the above part again ?  but this time see the num1 is not the one you entered, its //the value after the num1+5 is performed, so if you repeat this one more time like below what are the results //coming ?
  
// THIS IS THE PART OF CALCULATION 

 num3 = num2 * 1.0;
 sum1 = num1+num2 ;
 sum2 = num1+num3 ;
  prod1 = num1*num2 ;
 prod2 = num1*num3 ;
 quot1 = num1/num2 ;
 quot2 = num1/num3 ;
 rmd = num1 % num2 ;
cout << num1 << '\t' << num2 << '\t' << num3 << '\t' << sum1 << '\t' << sum2 <<$m2 << '\t' << prod1 << '\t' << prod2 << '\t'<< quot1 << '\t' << quot2 << '\t' $quot2 << '\t' << rmd << endl;
 num1=num1+5;
 num2=num2-4;
// PART OF CALCULATION ENDS HERE



 return 0;

}