Pointer |||| hackerrank || C++ language || programming_info


#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
void update(int *a,int *b)
 {
     int c,d;
    c= *a+*b;
    d=abs(*a-*b); 
    *a=c;
    *b=d; 
}
int main() {
    int a, b;
    int *pa = &a, *pb = &b;
    
    scanf("%d %d", &a, &b);
    update(pa, pb);
    printf("%d\n%d", a, b);

    return 0;
}





Share:

No comments:

Post a Comment

Translate

Recommended platforms

  1. codechef
  2. hackerrank
  3. codeforces
  4. leetcode
  5. hackerearth

Popular Posts

programming_info. Powered by Blogger.

Blog Archive

Recent Posts

other platforms

  • geeks for geeks
  • w3schools
  • codepen
  • skillshare
  • udemy

Pages

reader support Support