SIMPLE PROGRAM TO ADD TWO NUMBERS
#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;
}
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