bacco

Exchange Variable Values

May 22nd, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ExchangeVariableValues
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             var a = int.Parse(Console.ReadLine());
  10.             var b = int.Parse(Console.ReadLine());
  11.  
  12.             Console.WriteLine("Before:");
  13.             Console.WriteLine($"a = {a}");
  14.             Console.WriteLine($"b = {b}");
  15.  
  16.             var c = a;
  17.             a = b;
  18.  
  19.             Console.WriteLine("After:");
  20.             Console.WriteLine($"a = {a}");
  21.             Console.WriteLine($"b = {c}");
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment