Wednesday, July 16, 2014

C++ program to swap values

#include #include int main() { int a,b,temp; cout<<"please enter first value"; cin>>a; cout<<"please enter second value"; cin>>b; temp=a; a=b; b=temp; cout<<"your values after swapping a = "<

Tuesday, June 17, 2014

c++ program to swap two values

#include<iostream.h>

#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<iostream.h>

#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<iostream.h>

#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();

}