Write a C# Program to Do Basic Arithmetic Calculations



Let us do the following arithmetic calculations −

Sr.No Operator & Description
1 +
Adds two operands
2 -
Subtracts second operand from the first
3 *
Multiplies both operands
4 /
Divides numerator by de-numerator

The following is an example to perform arithmetic calculations using the above-given operators −

Example

 Live Demo

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

Output

Addition: 60
Subtraction: 20
Multiplication: 800
Division: 2
Updated on: 2020-06-22T07:23:17+05:30

587 Views

Kickstart Your Career

Get certified by completing the course

Get Started