There is an easy way to swapping values of two variables by using a temporary variable. But here am trying to get interchanged values between those variables without using any temporary variable. Just look in to this…
public int a = 10;
public int b = 20;
//Before swapping
textBox2.Text = b.ToString();
a = a + b;
b = a - b;
a = a - b;
textBox1.Text = a.ToString();
textBox2.Text = b.ToString();
This has been coded in a windows application using C#.
…S.VinothkumaR.
No comments:
Post a Comment