Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- void update(int *a, int *b)
- {
- int sum = 0;
- int difference = 0;
- sum = *a + *b;
- difference = abs(*a - *b);
- *a = sum;
- *b = difference;
- }
- int main()
- {
- int a;
- int b;
- cin >> a >> b;
- update(&a, &b);
- cout << a << endl;
- cout << b;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment