Basic C# Console

C# program to swap two numbers

This C# program swaps two numbers using a temporary variable. To swap numbers without using extra variable see another code below.

Variables are defined in the first row. In the next lines, values are assigned to these variables.

In the last line we print the result of processing on the screen.

This C# code swaps 2 Numbers.It obtains two numbers from the user and swaps the numbers using a temporary variable.

 

Swap two numbers without using third variable in C#

You can find more similar examples of programming for this programming language in the site.

Output:

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.