
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
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
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
- Related Articles
- C# Program to perform all Basic Arithmetic Operations
- Basic calculator program using C#
- Simple Arithmetic Operators Example Program In C++
- C++ Program for sum of arithmetic series
- C++ Program for class interval arithmetic mean
- C program to find the sum of arithmetic progression series
- C Program for Basic Euclidean algorithms?
- Write a C program to reverse array
- What is the basic structure of a C# program?
- How to do simple Arithmetic on Linux Terminal?
- Write program to shutdown a system in C/C++
- How to sum two integers without using arithmetic operators in C/C++ Program?
- Write a C# program to solve FizzBuzz problem
- C# Program to write an array to a file
- write about the arithmetic operator in javascript?

Advertisements