28 lines
513 B
C#
28 lines
513 B
C#
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;
|
||
}
|
||
}
|
||
}
|