Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- Action<int, int> op;
- op = Add;
- Operation(10, 6, op);
- op = Substract;
- Operation(10, 6, op);
- Console.Read();
- }
- static void Operation(int x1, int x2, Action<int, int> op)
- {
- if (x1 > x2)
- op(x1, x2);
- }
- static void Add(int x1, int x2)
- {
- Console.WriteLine("Сумма чисел: " + (x1 + x2));
- }
- static void Substract(int x1, int x2)
- {
- Console.WriteLine("Разность чисел: " + (x1 - x2));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement