C++ program to perform arithmetic sum

C++ program to perform arithmetic sum

In this chapter of C++ program tutorial our task is to :

  • Write a C++ program to accept user inputs
  • Perform arithmetic sum operation on the given inputs
  • Output the required solution on console

Given below is a C++ program to accept user input and perform arithmetic sum operation on it.

using namespace std;
int main()
    int a,b,c;
    cout<<"Enter the two numbers giving a space"<<endl;
    c = a + b;
    return 0;


Enter the two numbers giving a space.

3 7




In the above code:

  • the compiler enters the main function (here int main()),  and then creates each of 4 bits of memory space for variables a,b and c.
  • Then it takes the two integer as input and then store the value of a+b in a new variable c.
  • The c variable is then displayed in the output screen.

You can see the above code execution and output in codeblocks IDE:


CPP Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by

About the Author
Sayantan Bose
- šŸ”­ Iā€™m currently working on DS Algo skills - šŸŒ± Iā€™m currently learning web develeopement - šŸ‘Æ Iā€™m looking to collaborate with Oppia - šŸ“« Reach me at - šŸ˜„ Pronouns: his/him
Page Views :    Published Date : Jul 24,2020  
Please Share this page

Related Articles

Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!