Sunday, 1 September 2013

Swapping Program Without function

Posted by Unknown On 10:20 | No comments

/* Program to SWAP two variable without using THIRD variable in C++ (without function) */ 

/*In this program will will not use third variable to swap the the variable but we will be using the operator to do so*/



//Header file
#include<iostream.h>
int main()
{
int a,b;
cout<<"\n Enter First No:- ";
cin>>a;
cout<<"\n Enter Second No:- ";
cin>>b;
cout<<"\n Value before swaping. a= "<<a<<" b="<<b;
a=a+b;
b=a-b;
a=a-b;
cout<<"\n Value after swaping. a= "<<a<<" b="<<b;
return 0;
}

0 comments:

Post a Comment

Blogroll

Copyright © 2013 RAJ PRAJAPATI (raj@electronicsrj.com)

Comments

About Projects

We also Provide support in making Electronics Projects at different level at Cheapest price. Contact Us for the further help.