Reference Parameter Update

#include <iostream>

void update(int&x, int delta) {
    // Implement update logic here
    x += delta;
}

int main() {
    int32_t x, delta;
    std::cin >> x >> delta;

    update(x,delta);

    std::cout << x;   // Print updated value

    return 0;
}

Solving Approach

 

 

 

 

Upvote
Downvote
Loading...

Input

10 4

Expected Output

14