Header Ads Widget

Responsive Advertisement

swapping of two numbers without using third variable

 #include<stdio.h>

int main()

{

    int a,b;

    printf("Enter the value of a\n");

    printf("Enter the value of b\n");

    scanf("%d%d",&a,&b);

    a=a+b;

    b=a-b;

    a=a-b;

    printf("After swapping %d%d a&b ",a,b);

    return 0;

}


Post a Comment

0 Comments