A special site for solving fun programming problems and challenges, interested in computer science, programming, basics, data structure and algorithms

 

C++ Basic Solved Programs

Write a C++ Program to C++ Program to Add Two Numbers. Here’s simple Program to Add Two Numbers in C++ Programming Language.


In this program, user is asked to enter two integers. Then, the sum of those two integers is stored in a variable and displayed on the screen.

source code:

#include <iostream>

using namespace std;

int main()

{

    int n1,n2;

    cout<<"Enter first number: ";

    cin>>n1;

    cout<<"\nEnter second number: ";

    cin>>n2;

    cout<<endl<<"sum is: "<<n1+n2<<endl;

    return 0;

}

No comments:

Post a Comment