Tuesday, October 12, 2021

Sum, Difference, Product, and Quotient in C++

 Machine Problem

Sum, Difference, Product, and Quotient in C++   

Enter 1st number:  100

Enter 2nd number: 10

Sum: 110

Difference: 90

Product: 1000

Quotient:  10

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Program Listing

// math.cpp

// Prof. Jake Rodriguez Pomperada, MAED-IT, MIT

// www.jakerpomperada.com  and www.jakerpomperada.blogspot.com

// jakerpomperada@gmail.com

// Bacolod City, Negros Occidental Philippines


#include <iostream>

#include <iomanip>


/*


Sum, Difference, Product, and Quotient in C++


Enter 1st number:

Enter 2nd number:


Sum:

Difference:

Product:

Quotient: */


int main()

{

  double a=0.00,b=0.00;

  double sum=0.00,difference=0.00;

  double product=0.00, quotient=0.00;


  std::cout <<"\n\n";

  std::cout << "\tSum, Difference, Product, and Quotient in C++";

  std::cout <<"\n\n";

  std::cout <<"\tEnter 1st Number : ";

  std::cin >> a;

  std::cout <<"\tEnter 2nd Number : ";

  std::cin >> b;

  std::cout <<"\n";


  sum = (a+b);

  difference = (a-b);

  product = (a * b);

  quotient = (a/b);


  std::cout <<"\n";

  std::cout <<"\tSum        : " << sum <<"\n";

  std::cout <<"\tDifference : " << difference <<"\n";

  std::cout <<"\tProduct    : " << product <<"\n";

  std::cout << std::fixed << std::showpoint;

  std::cout << std::setprecision(2);

  std::cout <<"\tQuotient   : " << quotient<<"\n";

  std::cout <<"\n";

  std::cout <<"\tEnd of Program";

  std::cout <<"\n";

}



No comments:

Post a Comment