#include <iostream>
#include <cstdint>
using namespace std;
// a and b are 16-bit signed inputs
// sum and product are 32-bit signed outputs
void compute(int16_t a, int16_t b, int32_t& sum, int32_t& product) {
sum = static_cast<int32_t>(a) + static_cast<int32_t>(b);
product = static_cast<int32_t>(a) * static_cast<int32_t>(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;
}
Explanation & Logic Summary:
Firmware Relevance & Real-World Context:
Input
3 4
Expected Output
7 12