C# swap two number without using third variable

C# swap two number without using third variable

Top 10
16 Jul 2020
Give a thumbs up
2

C# SwapNumber


Introduction of c#

C# is a class based and object orientade programming language and general purpose language and multi programming language. And lexically scoped of c# programming language.

You can make desktop app and mobile app etc. C# is one of the programming language designed for the common language infastructre (CLI) . Inventor of Microsoft corporation in 2002.


Swap two number without using third variable


Step-1 open visual studio


Step-2 create program name


Step-3 write a program

  1. using System;
  2. public class swapNumber
  3. }
  4. public static void main(string[] args)
  5. {
  6. Int a = 7, b = 8;
  7. Console.WriteLine("Before swap number a= "+a+" b= "+b);<br>
  8. a = a*b
  9. b = a/b
  10. a = a/b
  11. Console.WriteLine("After swap number a= "+a+" b= "+b)<br>
  12. }
  13. }

Output is: a = 7, b = 8


Author
Top 10
Blogger Top 10 content related post

Post a comment
0 Comments: