Thursday, 31 January 2019

Write a program to add two numbers in C++

                                     SIMPLE PROGRAM TO ADD TWO NUMBERS


1. Write this code in any c++ software.


#include<iostream.h>
#include<conio.h>
int main()
{int x,y,sum=0;
cout<<"\nEnter value of x=";
cin>>x;
cout<<"\nEnter value of y=";
cin>>y;
sum=x+y;

cout<<"\nsum is equal to ="<<sum;
getch();
return 0;
}


2. Save the file with any name and use extension .cpp for saving file.

3. First compile your program and then run.

4.OutPut



No comments:

Post a Comment

👇 🌐 Top 10 Hosting for Developers in 2025: Fast, Reliable & Affordable

 Whether you’re a beginner building your first portfolio site or a professional developer deploying client projects, choosing the right host...