thegrudge

ExchangeVariableValues

Nov 13th, 2014
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. using System;
  2.     class ExchangeVariableValues
  3.     {
  4.         static void Main()
  5.         {
  6.             int a = 5;
  7.             int b = 10;
  8.             int temp;
  9.             Console.WriteLine("Starting values of the variables are: \na = {0} \nb = {1}", a, b);
  10.             temp = a;
  11.             a = b;
  12.             b = temp;
  13.             Console.WriteLine("After the exchange the new values of the variables are: \na = {0}\nb = {1}", a ,b);
  14.            
  15.         }
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment