Sum, Difference, Product and Qoutient in C++
Page 1 of 1
Sum, Difference, Product and Qoutient in C++
Output:
Enter a high number:
Enter a low number:
"The sum of two numbers is ___________"
"The difference of two numbers is ______"
"The product of two numbers is ________"
"The Qoutient of two numbers is _______"
"The two numbers are _____ and ______"
Answer Codes
kung gusto nyu naman may mga kulay ang mga titik try nyu to
With Font color:
Enter a high number:
Enter a low number:
"The sum of two numbers is ___________"
"The difference of two numbers is ______"
"The product of two numbers is ________"
"The Qoutient of two numbers is _______"
"The two numbers are _____ and ______"
Answer Codes
- Code:
# include <iostream>
using namespace std;
int main()
{
int a,b;
cout<<"Enter a high number: ";
cin>>a;
cout<<"Enter a low number: ";
cin>>b;
cout<<endl;
cout<<"the sum of the two numbers is "<<a+b<<endl;
cout<<"The difference of the two numbers is "<<a-b<<endl;
cout<<"The product of the two numbers is "<<a*b<<endl;
cout<<"The qoutient of the two numbers is "<<a/b<<endl;
cout<<"The two numbers are "<<a<<" and "<<b<<endl<<endl;
//system("pause");
return 0;
}
kung gusto nyu naman may mga kulay ang mga titik try nyu to
With Font color:
- Code:
# include <iostream>
# include <windows.h>
using namespace std;
int main()
{
int a,b;
HANDLE hConsole;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, 2);
cout<<"Enter a high number: ";
SetConsoleTextAttribute(hConsole, 3);
cin>>a;
SetConsoleTextAttribute(hConsole, 2);
cout<<"Enter a low number: ";
SetConsoleTextAttribute(hConsole, 3);
cin>>b;
system("cls");
cout<<endl<<endl;
SetConsoleTextAttribute(hConsole, 2);
cout<<"the sum of the two numbers is ";
SetConsoleTextAttribute(hConsole, 3);
cout<<a+b<<endl;
SetConsoleTextAttribute(hConsole, 2);
cout<<"The difference of the two numbers is ";
SetConsoleTextAttribute(hConsole, 3);
cout<<a-b<<endl;
SetConsoleTextAttribute(hConsole, 2);
cout<<"The product of the two numbers is ";
SetConsoleTextAttribute(hConsole, 3);
cout<<a*b<<endl;
SetConsoleTextAttribute(hConsole, 2);
cout<<"The qoutient of the two numbers is ";
SetConsoleTextAttribute(hConsole, 3);
cout<<a/b<<endl;
SetConsoleTextAttribute(hConsole, 2);
cout<<"The two numbers are ";
SetConsoleTextAttribute(hConsole, 3);
cout<<a;
SetConsoleTextAttribute(hConsole, 2);
cout<<" and ";
SetConsoleTextAttribute(hConsole, 3);
cout<<b<<endl<<endl;
//system("pause");
return 0;
}
princeterror- Universal Moderator
- Posts : 272
Credits : 11465
Fame : 81
Join date : 2012-06-07
Age : 33
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum