0% found this document useful (0 votes)
4 views1 page

C++ Program to Add Two Integers

Uploaded by

kshiprapandey
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

C++ Program to Add Two Integers

Uploaded by

kshiprapandey
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

#include <iostream>

using namespace std;

int main() {

int first_number, second_number, sum;

cout << "Enter two integers: ";

cin >> first_number >> second_number;

// sum of two numbers in stored in variable sumOfTwoNumbers

sum = first_number + second_number;

// prints sum

cout << first_number << " + " << second_number << " = " << sum;

return 0;

In this program, the user is asked to enter two integers. These two integers
are stored in variables first_number and second_number respectively.
Then, the variables are added using the + operator and stored in
the sum variable.
Finally, sum is displayed on the screen.

You might also like