Posts Tagged: swap two number

Swap of two numbers in C without using third variable.

Step 1: #include<stdio.h> #include<conio.h> void main() { int a,b; clrscr(); printf(“enter any two no “); scanf(“%d%d”,&a,&b); { a=a+b; b=a-b; a=a-b; } printf(“\n no are : %d%d”,a,b); getch(); } Step 2: Save it by pressing F2 and name it SWAP.CPP and… Continue Reading →

Swap two numbers without using third variable in java

In this article we learn how to swap two numbers without using third variable in java. Step 1: Lets open the notepad and write the following code: Lets try to find the error in this program. if we write the… Continue Reading →

swap two number without using any third variable and arithmetic operator.

swap two number without using any third variable and arithmetic operator.