编写一个 C# 程序来进行基本的算术计算

编写一个 C# 程序来进行基本的算术计算

让我们进行以下算术计算 -

+

添加两个操作数

Sr.No th> 运算符和描述
1
2 -

从第一个操作数中减去第二个操作数

3 *

两个操作数相乘

4 /

分子除以分子

以下是使用上述运算符执行算术计算的示例 -

示例

 实时演示

using System; namespace OperatorsApplication { class Program { static void Main(string[] args) { int a = 40; int b = 20; int c; c = a + b; Console.WriteLine("Addition: {0}", c); c = a - b; Console.WriteLine("Subtraction: {0}", c); c = a * b; Console.WriteLine("Multiplication: {0}", c); c = a / b; Console.WriteLine("Division: {0}", c); Console.ReadLine(); } } }登录后复制