A simple program to ask the user to give two numbers and then the program will add, subtract, multiply, and divide the two numbers and display the results using the C++ programming language.
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 in 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.Please subscribe to my channel https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg
Thank you very much for your support.
Program Listing
#include <iostream>
using namespace std;
int main()
{
cout <<"\n";
cout << "\tAdd,Subtract,Multiply, and Divide of Two Numbers in C++";
cout <<"\n\n";
while(true)
{
cout <<"\n\n";
cout << "\tEnter a First Value (negative to quit) : ";
int num1;
cin >> num1;
if(num1 < 0)
break;
cout << "\tEnter a second number (negative to quit) : ";
int num2;
cin >> num2;
if(num2 < 0)
break;
int sum = num1 + num2;
int difference = num1 - num2;
int product = num1 * num2;
int quotient = num1 / num2;
cout <<"\tThe sum of " <<num1 << " and " << num2 << " is " << sum << "\n";
cout <<"\tThe differene of " <<num1 << " and " << num2 << " is " << difference << "\n";
cout <<"\tThe product of " <<num1 << " and " << num2 << " is " << product << "\n";
cout <<"\tThe quotient of " <<num1 << " and " << num2 << " is " << quotient << "\n";
cout <<"\n\n";
cout << "\tEnd of Program";
cout <<"\n";
}
}
No comments:
Post a Comment