# C# program to demonstrate example of arithmetic operators

C# example for arithmetic operators: Here, we are writing a C# program to demonstrate example of all arithmetic operators.
Submitted by IncludeHelp, on April 06, 2019

Arithmetic operators are used to perform mathematic operations, here is the list of all C# arithmetic operators,

1. "+" (Addition) – it is used to add two number, string concatenation
2. "-" (Subtraction) – it is used to subtract second operand from first operand
3. "*" (Multiplication) – it is used to multiply two operands
4. "/" (Divide) – it is used to divide numerator from de-numerator
5. "%" (Modulus) - it is used to get remainder

Example:

```    Input:
int a = 10;
int b = 3;

//operations
int sum = a + b;
int sub = a - b;
int mul = a * b;
float div = (float)a / (float)b;
int rem = a % b;

Output:
sum = 13
sub = 7
mul = 30
div = 3.333333
rem = 1
```

C# code to demonstrate example of arithmetic operators

```// C# program to demonstrate example of
// arithmetic operators
using System;
using System.IO;
using System.Text;

namespace IncludeHelp
{
class Test
{
// Main Method
static void Main(string[] args)
{
int a = 10;
int b = 3;

int sum = a + b;
int sub = a - b;
int mul = a * b;
float div = (float)a / (float)b;
int rem = a % b;

Console.WriteLine("Addition of {0} and {1} is = {2}", a, b, sum);
Console.WriteLine("Subtraction of {0} and {1} is = {2}", a, b, sub);
Console.WriteLine("Multiplication of {0} and {1} is = {2}", a, b, mul);
Console.WriteLine("Division of {0} and {1} is = {2}", a, b, div);
Console.WriteLine("Remainder of {0} and {1} is = {2}", a, b, rem);

//hit ENTER to exit the program
}
}
}
```

Output

```Addition of 10 and 3 is = 13
Subtraction of 10 and 3 is = 7
Multiplication of 10 and 3 is = 30
Division of 10 and 3 is = 3.333333
Remainder of 10 and 3 is = 1
```

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates