CSharp-Learning/lessons/Lesson05/Helpers/MathHelper.cs
Rosmontis_Cloud f604d53191 Initial commit: C# 学习笔记和示例代码
- Lesson 01-10: C# 基础语法
- WebView2: 集成示例
- notes/: 详细笔记
2026-07-01 16:31:35 +08:00

28 lines
513 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;
}
}
}