Fix semantic errors

Report a typo

In the following C++ code snippet, there's a semantic error that results in incorrect results. Your task is to identify the semantic error and suggest a fix to produce the desired output.

Sample Input 1:

3 4

Sample Output 1:

Sum: 7

Sample Input 2:

0 0

Sample Output 2:

Sum: 0

Sample Input 3:

0 1

Sample Output 3:

Sum: 1
Write a program in C++
#include <iostream>

int main() {
int a, b;
std::cin >> a >> b;

int sum = a - b;

std::cout << "Sum: " << sum << std::endl;
return 0;
}

Create a free account to access the full topic