Source Code:-
using A = System.Console;
delegate int ArithOp( int x, int y);
class MathOperation
{
public static int Add(int a, int b)
{
return (a + b);
}
public static int Sub(int a, int b)
{
return (a - b);
}
}
class Demo
{
static void Main(string[] args)
{
ArithOp op1 = new ArithOp(MathOperation.Add);
ArithOp op2 = new ArithOp(MathOperation.Sub);
int result1 = op1(200, 100);
int result2 = op2(200, 100);
A.WriteLine("Addition=" + result1);
A.WriteLine("Substraction=" + result2);
A.ReadKey();
}
}
0 Comments