Code Competitions

Coding competition

Tuesday, 11 June 2013

program to swap numbers

#include<iostream.h>
#include<conio.h>
void main()
{
    void swap(int,int);
    clrscr();
    int a,b;
    cout<<"enter the values of a and b ";
    cin>>a>>b;
    swap(a,b);
    getch();
}
void swap(int a,int b)
{
    int c;
    c=a;
    a=b;
    b=c;
    cout<<"after swapping a = "<<a<<" b= "<<b;
}

No comments:

Post a Comment