snow

Blogger Widgets

c-program to swap using third variable


gowrikausalya.blogspot.com

/*c-program to swap two numbers using third variable */


#include<stdio.h>
#include<conio.h>
int main()
{
    int a,b,c;
    printf("Enter two numbers :");
    scanf("%d%d",&a,&b);
    printf("Before swapping..\n\n");
    printf("A=%d\nB=%d",a,b);
    c=a;
    a=b;
    b=c;
    printf("\n\nAfter swapping (using 3rd variable)...\n\n");
    printf("A=%d\nB=%d",a,b);
    getch();
}

OUTPUT
gowrikausalya.blogspot.com

No comments:

Post a Comment