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

DBMS NOTES UNIT 3

                                                              UNIT 3  ER (Entity Relationship) An entity-relationship model is known as an E...