Header Ad

C++ program to enter two numbers and show their sum

In this post, we are going to write a C++ program and enter two numbers and show or print their sum on the output screen.


C++ program to print sum of two numbers.

#include<iostream.h>
#include<conio.h>

void main()
{
    clrscr();

    int first,second;
    int sum;

    cout<<"Enter the value of first number = ";
    cin>>first;
    cout<<"Enter the value of second number = ";
    cin>>second;

    sum = first+second;

    cout<<"The sum is = "<<sum;

    getch();
}


Output

Enter the value of first number = 10
Enter the value of second number = 20
The sum is = 30

Post a Comment

0 Comments