Here goes the logic for Swapping two numbers without using third variable :




int a = 10;
int b = 20;

a = a + b;  // this make a equal to 30

b = a - b;   // this makes b equal to 10

a = a - b;   // this makes a equal to 20


Console.WriteLine(a);
Console.WriteLine(b)

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to