In this tutorial, you will learn how to write a C++ Program to find the sum of three numbers.

C++ Sum of Three Numbers

To find sum of three numbers in C++, use Arithmetic Addition Operator (+). If a, b, and c are the three numbers, then use the expression a + b + c to find the sum.

Program

In the following C++ Program, we read three numbers from user, and find their sum.

main.cpp

</>
Copy
#include <iostream>
using namespace std;

int main() {
    int a, b, c;
    cout << "Enter first number  : ";
    cin >> a;
    cout << "Enter second number : ";
    cin >> b;
    cout << "Enter third number  : ";
    cin >> c;
    
    int sum = a + b + c;
    cout << "Sum : " << sum << endl;
}

Output

Enter first number  : 2
Enter second number : 3
Enter third number  : 4
Sum : 9
Program ended with exit code: 0
Enter first number  : -2
Enter second number : 7
Enter third number  : 0
Sum : 5
Program ended with exit code: 0

Conclusion

In this C++ Tutorial, we learned how to add three numbers using Arithmetic Addition Operator.