Hello Dude, here is some more method of swapping of two numbers.
Works number that is not Zero.
ie, A!=B!=0;

a=a*b;
a=a/b;
b=b/a;

2nd method works for all values.
a=b+a-(b=a);

I guess this method works for negative numbers.
a=a^b;
b=b^a;
a=a^b;

if i'm wrong plz do correct me.... Thank you.

On 5/8/07, manoj viswakarma <[EMAIL PROTECTED]> wrote:
>
>
>
> lucky sanket <[EMAIL PROTECTED] <lucky_04itgcet%40yahoo.co.in>>
> wrote: hi frnds,
>
> can you swap two variables without using pointer, temporary variable &
> this logic b=a-b,a=a-b,b=a+b in c or c++???
>
> let a=10,b=25;
> a=a+b;//here value of a=35
>
> b=a-b;//here value of b=10 ok.
> a=a-b;//here value of a=25 ok.
>
> i think u got ur answer..........
>
> __.letlllkllhjsafhjhhasf_.___
>
> Recent Activity
>
> 60
> New Members
>
> Visit Your Group
> SPONSORED LINKS
>
> Computer programming languages
> Java programming language
> Basic programming language
> Programming languages
> C programming language
>
> Yahoo! Finance
> It's Now Personal
> Guides, news,
> advice & more.
>
> New business?
> Get new customers.
> List your web site
> in Yahoo! Search.
>
> Y! Messenger
> Instant hello
> Chat in real-time
> with your friends.
>
>
>
> .
>
>
>
>
>
> ---------------------------------
> Here's a new way to find what you're looking for - Yahoo! Answers
>
> [Non-text portions of this message have been removed]
>
>  
>



-- 
Thank You,
      The Clouds That Wander Through The
      Sky Have No Roots, No Home;
      Nor The Distinctive Thoughts Floating Through The Mind...


[Non-text portions of this message have been removed]

Reply via email to