16-bit Sum Product

#include <iostream>
#include <cstdint>
using namespace std;

// Write your code here
void compute(int16_t a, int16_t b, int32_t &sum, int32_t &product) {
    sum = a + b;
    product = 1ll * a * b;
}

int main() {
    int16_t a, b;
    cin >> a >> b;

    int32_t sum = 0, product = 0;

    compute(a, b, sum, product);

    cout << sum << " " << product;

    return 0;
}

Solving Approach

 

 

 

 

 

 

Upvote
Downvote
Loading...

Input

3 4

Expected Output

7 12