Wednesday 24 September 2014

Swapping The values of X and Y in C-plusplus programming.




// bilal.cpp : Defines the entry point for the console application.
//www.newplusplus.blogspot.com
//compilar: visual studio 2008
//PROGRAMMER: BILAL KHAN

#include "stdafx.h"
#include <iostream>
using namespace std;

int main()
{

int x;
int y;

cout<<" Enter the value of X : ";
cin>>x;

cout<<" Enter the value of Y: ";
cin>>y;

x = x + y;
y = x - y;
x = x - y;


cout<<" After Swapping the value of X is : "<<x<<endl;
cout<<" After Swapping the value of Y is : "<<y
<<endl;

system("pause");
return 0;
}



----------------------------------------------------------------------------------------------------------------------
OUTPUT OF THE PROGRAMME IS :


0 comments:

Post a Comment