Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


swapping of two numbers without using third variable using
AND and OR operators

Answers were Sorted based on User's Feedback



swapping of two numbers without using third variable using AND and OR operators..

Answer / ramesh reddy

a = a^b; b =a^b; a =a^b;
or
a=a+b; b=a-b; a=a-b;

Is This Answer Correct ?    43 Yes 2 No

swapping of two numbers without using third variable using AND and OR operators..

Answer / vignesh1988i

however we can implement using EXoR , where it is made of
AND and OR gate too....

x=90;
y=51;
x^=y^=x;
the value of x & y will be swapped.

Is This Answer Correct ?    8 Yes 8 No

Post New Answer

More C Interview Questions

#include<stdio.h> int main(){ int a[]={1,2,3,5,1}; int *ptr=a+4; int y=ptr-a; printf("%d",y); }

3 Answers   Zoho,


please explain every phase in the "SDLC" in the dotnet.

0 Answers  


What is the difference between volatile and const volatile?

0 Answers  


What are the advantage of c language?

0 Answers  


#define f(x) main() { printf("\n%d",f(2+2)); }

5 Answers  


FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above

0 Answers  


main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); }

10 Answers   TCS, Vector,


What is a nested loop?

0 Answers  


How many ways are there to swap two numbers without using temporary variable? Give the each logic.

9 Answers  


tell me the full form of c?

2 Answers  


What are the types of functions in c?

0 Answers  


Explain what is the benefit of using enum to declare a constant?

0 Answers  


Categories