Swapping two variable without using third variable | C-Program

Swapping without using third variable:

Code:

#include<stdio.h>

void main()

{

    int a,b;

    printf("Enter two number:\n");

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

    printf("You decide a= %d and b= %d to swap:\n",a,b);

    a=a+b;

    b=a-b;

    a=a-b;

    printf("a=%d and b=%d",a,b);

}

Output:


Popular posts from this blog

TOP 10 PROGRAMMING LANGAUAGES COMMING 2021 | ARTICLE

Write a C-program to swap two number:

Print Fibonacci Series using Recursion | C program :