how to swap two integers 1 and 32767 without using third
variable

Answer Posted / mani654mani

Int var1=1, var2=32767;
var1 = var1 + var2;
var1 = 1 + 32767 =32768;

var2 = var1 - var2;
var2 = 32768 - 32767 = 1;

var1 = var1 - var2;
var1 = 32768 - 1 = 32767;

So Now var1 = 32767 and var2 = 1

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why dont c comments nest?

613


How do you search data in a data file using random access method?

825


What are the header files used in c language?

578


how to count no of words,characters,lines in a paragraph.

3895


How many types of sorting are there in c?

602






How do you print only part of a string?

606


What is the general form of function in c?

607


What is boolean in c?

601


#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??

1539


What is the use of parallelize in spark?

570


Write a program that accept anumber in words

1246


Write a program to implement queue.

655


Explain what is wrong with this statement? Myname = ?robin?;

988


What is the size of structure pointer in c?

608


What is function prototype in c language?

606