C# Program for Addition, Subtraction, Multiplication, Division

Addition-Subtraction-Multiplication-Division

C# program for addition, subtraction, multiplication and division has been shown here. These are the basic arithmetic operations.






1. C# program & output for Addition, Subtraction, Multiplication & Division

Code has been copied
/***************************************************************
                alphabetacoder.com
 C# program for addition, subtraction, multiplication, division
****************************************************************/

using System;

namespace Operation
{
    class Program
    {
        static void Main(string[] args)
        {
            // declare variables
            double a, b, w, x, y, z;
            
            //take input in fahrenheit
            Console.Write("Enter first number: ");
            a = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter second number: ");
            b = Convert.ToDouble(Console.ReadLine());
            
            // compute operation
            w = a + b;
            x = a - b;
            y = a * b;
            z = a / b;
        	
            // display output
            Console.WriteLine("Addition: "+w);
            Console.WriteLine("Subtraction: "+x);
            Console.WriteLine("Multiplication: "+y);
            Console.WriteLine("Division: "+z);

            // wait for user to press any key
            Console.ReadKey();
        }
    }
}

Output


Enter first number: 55

Enter second number: 10.5

Addition: 65.5

Subtraction: 44.5

Multiplication: 577.5

Division: 5.23809523809524