CSharp-Learning/lessons/Lesson05/Helpers/MathHelper.cs

28 lines
513 B
C#
Raw Permalink Normal View History

using System;
namespace Lesson05.Helpers
{
static class MathHelper
{
public static int Add(int a, int b)
{
return a + b;
}
public static int Multiply(int a, int b)
{
return a * b;
}
public static double Divide(int a, int b)
{
if (b == 0)
{
Console.WriteLine("除数不能为0");
return 0;
}
return (double)a / b;
}
}
}