Program to swap two numbers with/without using temporary variable

Program

#include <stdio.h>

int main()
{
    printf("************************************************************");
    printf("\n************************************************************");
    printf("\n**WAP to Swap two no with/without using temporary variable**");
    printf("\n**                 Created by Sheetal Garg                **");
    printf("\n**                   Assistant Professor                  **");
    printf("\n**                   Phone No:9467863365                  **");
    printf("\n************************************************************");
    printf("\n************************************************************\n");
    int a,b,temp;
    printf("\nEnter two numbers : ");
    scanf("%d%d",&a,&b);
    printf("\nNUmbers before Swapping are a= %d and b=%d\n",a,b);   
    printf("\nUsing temporary variable");
    temp=a;
    a=b;
    b=temp;
    printf("\nAfter swapping a is %d and b is %d",a,b);
    printf("\n\nWithout Using temporary variable");
    a=a+b;
    b=a-b;
    a=a-b;
    printf("\nAfter again swapping a and b set to original values ie");
    printf("\na is %d and b is %d",a,b);
    return 0;
}

Output

************************************************************
************************************************************
**WAP to Swap two no with/without using temporary variable**
**                 Created by Sheetal Garg                **
**                   Assistant Professor                  **
**                   Phone No:9467863365                  **
************************************************************
************************************************************

Enter two numbers : 50
60

NUmbers before Swapping are a= 50 and b=60

Using temporary variable
After swapping a is 60 and b is 50

Without Using temporary variable
After again swapping a and b set to original values ie
a is 50 and b is 60

error: You can only copy the programs code and output from this website. You are not allowed to copy anything else.