Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

C# Arithmetic operators

int result; 
 
result = 10 + 5;  // 15
 
result = 10 - 5;  // 5
 
result = 10 * 5;  // 50
 
result = 10 / 5;  // 2
 
result = 10 % 5;  // 0
Comment

C# Arithmetic Operators

int x = 5;
int y = 10;
int z = x + y;// z = 15
Comment

C# Arithmetic Operators

using System;
 
namespace Operator
{
	class ArithmeticOperator
	{
		public static void Main(string[] args)
		{
			double firstNumber = 14.40, secondNumber = 4.60, result;
			int num1 = 26, num2 = 4, rem;

			// Addition operator
			result = firstNumber + secondNumber;
			Console.WriteLine("{0} + {1} = {2}", firstNumber, secondNumber, result);

			// Subtraction operator
			result = firstNumber - secondNumber;
			Console.WriteLine("{0} - {1} = {2}", firstNumber, secondNumber, result);

			// Multiplication operator
			result = firstNumber * secondNumber;
			Console.WriteLine("{0} * {1} = {2}", firstNumber, secondNumber, result);

			// Division operator
			result = firstNumber / secondNumber;
			Console.WriteLine("{0} / {1} = {2}", firstNumber, secondNumber, result);

			// Modulo operator
			rem = num1 % num2;
			Console.WriteLine("{0} % {1} = {2}", num1, num2, rem);
		}
	}
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# bitwise xor 
Csharp :: how to export xml in linq c# 
Csharp :: how to get odd saturday in a month in c# 
Csharp :: c# fileinfo filename without extension 
Csharp :: unity shader blend 
Csharp :: ExecuteResultAsync ActionContext statuscode 
Csharp :: google script get font color 
Csharp :: c# enum variable set to nonthing 
Csharp :: .net mvc foreach with index 
Csharp :: auto scroll infinite scroller unity 
Csharp :: c# unary operators 
Csharp :: small index c# 
Csharp :: what loops are entry controlled c# 
Csharp :: chaine de connexion sql server c# 
Csharp :: how to store more precise data then float c# 
Csharp :: python mokeypatch asser called 
Csharp :: Razor while loop 
Csharp :: Unity SceneLoad by Name in Inspector 
Csharp :: osk c# 
Csharp :: vb.net ionic zip examples 
Csharp :: attribute decorator to require email format of string c# 
Csharp :: how to make a respaen script in unity 
Csharp :: f# set function how to ignore duplicates 
Csharp :: c# how to group console output into columns 
Csharp :: ddsfsd 
Csharp :: spring jar debug level running 
Csharp :: .netstandard distinctby iqueryable 
Csharp :: Write N lines with M numbers each that describe the layout of the second layer in the way shown above 
Csharp :: linq cross join 
Csharp :: .net core get exe path 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =