Tuesday, June 17, 2014
c++ program to swap two values
#include<conio.h>
using namespace std;
int main( )
{
int temp;
int a;
int b;
cout<<"please enter first integer ";
cin>>a;
cout<<"please enter second integer";
cin>>b;
temp=a;
a=b;
b=temp;
cout<<"after swapping"<<endl<<a<<b;
return 0;
getch();
}
c++ program to multiply two integers
#include<conio.h>
using namespace std;
int main( )
{
int a;
int b;
cout<<"please enter first integer for multiplication";
cin>>a;
cout<<"please enter second integer for multiplication";
cin>>b;
cout<<"your sum is "<<a*b<<endl;
return 0;
getch();
}
c++ program to add two integers
#include<conio.h>
using namespace std;
int main( )
{
int a;
int b;
cout<<"please enter first integer for sum";
cin>>a;
cout<<"please enter second integer for sum";
cin>>b;
cout<<"your sum is "<<a+b<<endl;
return 0;
getch();
}
Subscribe to:
Posts
(
Atom
)