The main purpose of "Dot Net Labs" provide the dot net program. You can learn dot net, .Net Core, C#, SQL, Linq step-by-step.

Showing posts with label Operator. Show all posts
Showing posts with label Operator. Show all posts

Tuesday, 17 January 2017

Modulus Operator in C#


In this article we will explain how to use ( % ) Modulus Operator in C#. Modulus find the remainder.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int number1, number2, results;
            //Size of int : Signed 32-bit integer, accept numerical values
            number1 = 10;
            number2 = 5;
            results = number1 % number2;
            Console.Write("Your Results is : "+results);
            //Writes the line
            //results is a local variable which type of integer
            Console.ReadKey();
            // Console.ReadKey is method and we can use Console.ReadKey method for reading purpose
            // Press key and back to console window
        }
    }
}

The output is :

Your Results is : 2







Divided Operator in C#


In this article we will explain how to use ( / ) Divided Operator in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int number1, number2, results;
            //Size of int : Signed 32-bit integer, accept numerical values
            number1 = 10;
            number2 = 5;
            results = number1 / number2;
            Console.Write("Your Results is : "+results);
            //Writes the line
            //results is a local variable which type of integer
            Console.ReadKey();
            // Console.ReadKey is method and we can use Console.ReadKey method for reading purpose
            // Press key and back to console window
        }
    }
}

The output is :

Your Results is : 2





Multiplication Operator in C#


In this article we will explain how to use ( * ) Multiplication Operator in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int number1, number2, results;
            //Size of int : Signed 32-bit integer, accept numerical values
            number1 = 5;
            number2 = 10;
            results = number1 * number2;
            Console.Write("Your Results is : "+results);
            //Writes the line
            //results is a local variable which type of integer
            Console.ReadKey();
            // Console.ReadKey is method and we can use Console.ReadKey method for reading purpose
            // Press key and back to console window
        }
    }
}

The output is :

Your Results is : 50







Subtraction Operator in C#


In this article we will explain how to use ( - ) Subtraction Operator in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int number1, number2, results;
            //Size of int : Signed 32-bit integer, accept numerical values
            number1 = 10;
            number2 = 5;
            results = number1 - number2;
            Console.Write("Your Results is : "+results);
            //Writes the line
            //results is a local variable which type of integer
            Console.ReadKey();
            // Console.ReadKey is method and we can use Console.ReadKey method for reading purpose
            // Press key and back to console window
        }
    }
}

The output is :

Your Results is : 5







Addition Operator in C#


In this article we will explain how to use ( + ) Addition Operator in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int number1, number2, results;
            //Size of int : Signed 32-bit integer, accept numerical values
            number1 = 5;
            number2 = 10;
            results = number1 + number2;
            Console.Write("Your Results is : "+results);
            //Writes the line
            //results is a local variable which type of integer
            Console.ReadKey();
            // Console.ReadKey is method and we can use Console.ReadKey method for reading purpose
            // Press key and back to console window
        }
    }
}

The output is :

Your Results is : 15






Friday, 19 June 2015

Operator in C#


Arithmetic Operators
+Addition
-Subtraction
*Multiplication
/Divided
%Modulus
++Increment Operator
--Decrement Operator
Relational Operators
==Equal To
!=Not Equal
<Less Than
>Greater Than
>=Greater Than or Equal
<=Less Than or Equal to
Logical Operators
&&Logical AND operator
||Logical OR Operator
!Logical NOT Operator
Bitwise Operators
&AND Operator
|OR Operator
^XOR Operator
~Ones Complement Operator
<<Left Shift Operator
>>Right Shift Operator
Assignment Operators
=Assignment Operator
+=Add assignment Operator
-=Sub assignment Operator
*=Multiply assignment Operator
/=Divide assignment Operator
%=Modulus assignment Operator
<<=Left shift assignment Operator
>>=Right shift assignment Operator
&=Bitwise assignment Operator
^=bitwise exclusive OR assignment Operator
|=bitwise inclusive OR assignment Operator

Popular Posts