Sort by

recency

|

1165 Discussions

|

  • + 0 comments

    I like how it helps build a solid foundation for more advanced topics like dynamic memory and data structures, Playingexchange Login

  • + 0 comments

    include

    void update(int *a,int *b) { // Complete this function
    *a = *a + *b; if (a-2(*b) <0){ *b = (a - 2(b))(-1); }else{ *b = a - 2(*b); } }

    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;
    

    }

  • + 0 comments
    void update(int* a,int* b) {
        int temp = *a;
        *a = *a + *b; 
        *b = abs(temp - *b);      
    }
    int main() {
        int a, b;
        int* pa = &a;
        int* pb = &b;
        
        scanf("%d %d", &a, &b);
        update(pa, pb);
        printf("%d\n%d", a, b);
    
        return 0;
    }
    
  • + 0 comments
    #include<bits/stdc++.h>
    using namespace std;
    
    void update(int a, int b)
    {
        int t1=a,t2=b;
        a=t1+t2;
        b=abs(t1-t2);
        cout<<a<<endl<<b; 
    }
    int main()
    {
        int a=0,b=0;
        cin>>a>>b;
        update(a,b);
        return 0;
    }
    
  • + 0 comments
    void update(int *a,int *b) {
        *a = *a + *b;
        *b = abs((*b)*2 - *a); 
    }