Friday, September 23, 2011

WAP to swap two numbers using third variable


/*
  Name: WAP to swap two numbers using third variable
  Author: Parveen Malik
  Date: 23/09/11 10:50
*/


#include <stdio.h>
#include <conio.h>


int main()
{
    int x,y,temp;
    printf("Enter the value of x and y \n");
    scanf("%d%d",&x,&y);
    printf("Before swapping \nx = %d\ny = %d",x,y);
    temp=x;
    x=y;
    y=temp;
    printf("\nAfter swapping \nx = %d\ny = %d",x,y);
    getch();
    return 0;
}


OUTPUT : 



0 comments:

Post a Comment