Last active
August 20, 2017 21:27
-
-
Save mohnoor94/48a46aa8e67285ddbc27ef3eb14beeb8 to your computer and use it in GitHub Desktop.
A full C++ program contains a function that takes 2 integer variables x and y, returns the multiplication of x and y in variable mul, and the division of x and y in variable div.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // www.abukhleif.com | |
| #include <iostream> | |
| using namespace std; | |
| void multiplyAndDivide (int x, int y, int& mul, double& div) { | |
| mul = x * y; | |
| div = (x * 1.0) / y; | |
| } | |
| int main() { | |
| int n1, n2, m; | |
| double d; | |
| cin>> n1 >> n2; | |
| multiplyAndDivide(n1, n2, m, d); | |
| cout<< n1 <<" * " << n2 << " = " << m << endl | |
| << n1 <<" / " << n2 << " = " << d << endl; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment