Search This Blog

Translate

C Program for swapping two numbers without using third variable

C Program for swapping two numbers without using third variable

void main()
{
    int a,b,temp=0;
    clrscr();
    printf("\nEnter the first number=");
    scanf("%d",&a);
    printf("\nEnter the second number=");
    scanf("%d",&b);
    printf("\n\n*** Original value ***\nFirst value is=%d\n\nSecond value is=%d",a,b);
    temp=a;
    a=b;
    b=temp;
    printf("\n\n*** After swapping ***\n\nFirst value is=%d\n\nSecond value is=%d",a,b);
    getch();
}

C Program for swapping two numbers without using third variable




C Program example List

Google+ Badge