Sort by

recency

|

1145 Discussions

|

  • + 0 comments

    void update(int *a,int *b) { int num1 = (*a); int num2 = (*b); num1 = (*a) + (*b); num2 = (*a) - (*b); if (num2 < 0) { num2 = -num2; } *a = num1; *b = num2;

    }

  • + 0 comments

    void update(int *a,int *b) { int sum= (*a)+(*b); int diff= abs((*a)-(*b));
    (*a)=sum; (*b)=diff; } this may help :)

  • + 0 comments

    Hey, this is my code. Insights would be appreciated. Happy learning!

    #include <stdio.h>
    #include <math.h>
    
    void update(int *a,int *b) {
        // Complete this function 
        int temp;``
        temp = *a;  
        (*a) = (*a) + (*b);
        (*b) = abs((temp)-(*b));
    }
    
  • + 0 comments

    Using Ternary Operator

    void update(int *a,int *b) {
        int x=*a + *b;
        int diff=*a-*b;
        int y=(diff<0 ? -diff : diff;
        *a=x;
        *b=y;
    }
    
  • + 0 comments

    `Hey guys :

    include

    void update(int *a,int *b) { // Complete this function
    int sum = *a + *b; int sub = abs(*a - *b);

    *a = sum;````
    *b = sub;
    

    } `