using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace callByRefer
{
class Program
{
public static void swap(ref int a, ref int b)
{
a = a + b;
b = a - b;
a = a - b;
Console.WriteLine("after swapping value of a {0} and b {1}", a, b);
}
static void Main(string[] args)
{
int c = 10, d = 20;
Console.WriteLine("before swapping value of a {0} and b is{1}", c, d);
swap(ref c, ref d);
}
}
}
No comments:
Post a Comment