.
Home About-us Privacy Policy Contact-us Services

Thursday, October 8, 2015

C++ Program to swap two Number

ad+1

Program -



#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
void swap(int,int);
a=5;
b=23;
cout<<"\n value of a="<<a<<"and value of b="<<b<<"before swap";
swap(a,b);
cout<<"\n value of a="<<a<<"and value of b="<<b<<"after the swap";
getch();
}
void swap(int x,int y)
{
int temp;
temp=x;
x=y;
y=temp;
return;
}
 Output - 


 value of a=5and value of b=23before swap
 value of a=5and value of b=23after the swap








0 comments:

Post a Comment

Home About-us Privacy Policy Contact-us Services
Copyright © 2014 All Programs Examples | All Rights Reserved. Blogger Templates Download Blogger Templates