Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

swapping of two numbers without using third variable in c

#include<stdio.h>
void main()
{
	int x = 10, y = 20;
    printf("Before swap x=%d y=%d",x,y);
    x=x+y;
    y=x-y;
    x=x-y;
    printf("
After swap x=%d y=%d",x,y);
}
 
PREVIOUS NEXT
Tagged: #swapping #numbers #variable
ADD COMMENT
Topic
Name
6+9 =