Write a C program for swapping of two numbers without using third variables?

#include<stdio.h>
#include<conio.h>
void main()
{
    int a, b;
    printf("Enter two numbers: ");
    scanf("%d %d",&a ,&b);

    a = a+b;
    b = a-b;
    a = a-b;

    printf("After Swapping: ");
    printf("a = %d\t",a);
    printf("b = %d",b);
    getch();
}

Output:


Comments

Popular posts from this blog

Larch Soft Pvt. Ltd. - Best Website & Hosting Provider