C++ How To Add Two Numbers

Configurare noua (How To)

Situatie

Add Two Numbers- Learn how to add two numbers in C++:

Solutie

Add Two Numbers with User Input

In this example, the user must input two numbers. Then we print the sum by calculating (adding) the two numbers:

Example:
int x, y;
int sum;
cout << “Type a number: “;
cin >> x;
cout << “Type another number: “;
cin >> y;
sum = x + y;
cout << “Sum is: “ << sum;

Tip solutie

Permanent

Voteaza

(20 din 44 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?