• + 0 comments

    Simplest solution is below,

    include

    using namespace std;

    void update(int *pa,int *pb){ int temp = *pa; *pa = *pa + *pb; *pb = temp > *pb ? temp - *pb : *pb-temp; }

    int main(){ int a,b; cout <<"Enter a & b: "; cin >>a>>b; update(&a,&b); cout <<"sum: "<