# Arithmetic Operators In C#

In this article explain I will explain how to perform the various arithmetic operations like Addition, Subtraction, Multiplication and divide In C#.
• 3405

Introduction

The concept of arithmetic operators are very useful in C#. Arithmetic Operators are used for basic mathematical calculation in C# programming. When we are writing a program, you need various types of operators to calculate value. These operator performs basic calculation such as add, subtraction, multiplication, division, and modulus. The list of Arithmetic Operators is given below

Arithmetic Operators

 Operator Explanation Example + Add numbers A = num1 + num2 - Subtract numbers A = num1 - num2 * Multiply numbers A = num1 *  num2 / Divide numbers A = num1 / num2 % Divide two numbers and returns reminder A = 10%2 then A will be 2

Example

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace Arithmetic_Operators

{

class Program

{

static void Main(string[] args)

{

int num1, num2;

float div;

Console.Write("Enter first number\t\t");

Console.Write("\n\nEnter second number\t\t");

// "+" operator for adding values

//Used - operator for subtracting values

sub = num1 - num2;

// "*" operator for multiplying values

mul = num1 * num2;

// "/" operator for dividing values

div = (float)num1 / num2;

//Displaying Output

Console.WriteLine("\n\n=====================\n");

Console.WriteLine("Subtraction\t\t{0}", sub);

Console.WriteLine("Multiplication\t\t{0}", mul);

Console.WriteLine("Division\t\t{0}", div);

Console.WriteLine("\n=======================\n");

}

}

}

The output of following program 