How to swap two variables, without using third variable ?

Answer Posted / debjyoti talukder

a=a+b;
if(a>b)//only the smaller can b subtracted from greater...
b=a-b://...reverse is not possible
else
b=b-a;
a=a-b;

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

2857


Write a program to model an exploding firecracker in the xy plane using a particle system

3686


write a simple calculator c program to perform addition, subtraction, mul and div.

3143


can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

2325


#include int main(void) { int a=4, b=2; a=b<>2 ; printf("%d",a); return 0; }

1067






how to test pierrot divisor

2256


write a program for area of circumference of shapes

2028


Design an implement of the inputs functions for event mode

2957


What is full form of PEPSI

1865


Write a routine to implement the polymarker function

4375


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

493


why nlogn is the lower limit of any sort algorithm?

2373


Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

3845


Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??

1770


how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.

2136