Home >Backend Development >C#.Net Tutorial >Write a C# program to perform basic arithmetic calculations
Let us do the following arithmetic calculation-
Sr.No th> | Operators and Description |
---|---|
1 | |
2 |
- Subtract the second operand from the first operand |
3 |
* Multiply the two operands |
4 |
/ Numerator divided by numerator |
The following is Example of performing arithmetic calculations using the above operators -
Live Demonstration
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(); } } }
Addition: 60 Subtraction: 20 Multiplication: 800 Division: 2
The above is the detailed content of Write a C# program to perform basic arithmetic calculations. For more information, please follow other related articles on the PHP Chinese website!