Mira2706

poiters_stefi

Feb 4th, 2020
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. void update(int *a, int *b)
  8. {
  9.     int sum = 0;
  10.     int difference = 0;
  11.     sum = *a + *b;
  12.     difference = abs(*a - *b);
  13.     *a = sum;
  14.     *b = difference;
  15. }
  16.  
  17. int main()
  18. {
  19.     int a;
  20.     int b;
  21.     cin >> a >> b;
  22.     update(&a, &b);
  23.  
  24.     cout << a << endl;
  25.     cout << b;
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment