编辑代码

using System;

public delegate int MathOpertion(int a, int b);

public class HelloWorld
{

    public static int Calculate(int x, int y, MathOpertion operation)
    {
        return operation(x,y);
    }

    static int Add(int a,int b) => a+b;
    static int Multiply(int a,int b)=>a*b;
    public static void Main()
    {
       //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。
        Console.WriteLine("HELLO world!     - cs.jsrun.net ");
        int result1 =Calculate(5,4,Add);
        int result2 =Calculate(5,4,Multiply);
        Console.WriteLine($"加法:{result1}");
        Console.WriteLine($"乘法:{result2}");

        int result3 = Calculate(5,4,(a,b)=>a-b);
        Console.WriteLine($"减法:{result3}");
    }
}