C# Program to perform all Arithmetic Operations.

 using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Collections;

using System.Threading;

using System.IO;


namespace CSharpProgram

{

    class AkbTechie

     {

            static void Main(string[] args)

                {

                    int x = 20;

                    int y = 3;

                    int add = x + y;

                    int sub = x - y;

                    int mul = x * y;

                    float div = (float)x / (float)y;

                    int rem = x % y;

                    Console.WriteLine("Addition of {0} and {1} is = {2}", x, y, add);

                    Console.WriteLine("Subtraction of {0} and {1} is = {2}", x, y, sub);

                    Console.WriteLine("Multiplication of {0} and {1} is = {2}", x, y, mul);

                    Console.WriteLine("Division of {0} and {1} is = {2}", x, y, div);

                    Console.WriteLine("Remainder of {0} and {1} is = {2}", x, y, rem);    

                    Console.ReadKey();

          }

    }

}

Output:-

Addition of 20 and 3 is = 23

Subtraction of 20 and 3 is = 17

Multiplication of 20 and 3 is = 60

Division of 20 and 3 is = 6.666667

Remainder of 20 and 3 is = 2

एक टिप्पणी भेजें

0 टिप्पणियाँ