Professional Documents
Culture Documents
Homework #3
Homework #3
Homework #3
CST 2403-E339
H/W #3
#include <iostream>
//ggprog11
//Print the sum, difference, product and quotient of 2 numbers using cin
using namespace std;
int main()
{
int a,b;
cout<<"Enter 2 Numbers:"<<endl;
cin>>a>>b;
cout<<"Sum="<<a+b<<endl;
cout<<"Product="<<a*b<<endl;
cout<<"Difference="<<a-b<<endl;
cout<<"Quotient="<<a/b<<endl;
system ("pause");
return 0;
#include <iostream>
using namespace std;
//ggprog12
//Print the sum, different, product, and quatient of 2 numbers using cin and
assignment statements.
int main()
{
int a,b;
cout<< "Enter two numbers:" <<endl;
cin>>a>>b;
cout<< "Sum=="<<a+b<<endl;
cout<< "Product=="<<a*b<<endl;
cout<< "Difference=="<<a-b<<endl;
cout<< "Quotient=="<<a/b<<endl;
system ("pause");
return 0;
}
3. Define
Relationals The binary relational operators determine the following like less than, greater than,
less than or equal to and greater than or equal to.
Condition - The conditional operator evaluates an expression returning a value if the expression
is true and if a different one if the expression is false.
Logical Operator - A logical operator in C++ are mostly of signs that are not part of the
alphabet but are available in keyboards. This makes C++ code shorter and more international.
Start
4a
Read A
Read B
Sum A+B
Print Sum
End
Start
4b
Read A,B
Is A>B
Print B Print A
End