Sum, Multiplication, Division Console Application Example

Write a console application program in which accept two integer values and return sum, multiplication, division and subtraction of given values.

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

namespace MyExample1
    class Program
        static void Main(string[] args)
            int a, b, sum, mult, sub;
            float div;
            Console.WriteLine("Enter Value of a and b\n");
            a = Convert.ToInt32(Console.ReadLine());
            b = Convert.ToInt32(Console.ReadLine());

            sum = a + b;
            Console.WriteLine("\nThe Sum of {0} and {1} = {2}\n", a, b, sum);

            mult = a * b;
            Console.WriteLine("The Multiplication of {0} and {1} = {2}\n", a, b, mult);

            div = (float)a / b;
            Console.WriteLine("The Division of {0} and {1} = {2}\n", a, b, div);

            sub = a - b;
            Console.WriteLine("The Substraction of {0} and {1} = {2}\n", a, b, sub);


The output of console application is :

Console application program for sum,multiplication, division and subtraction.
Console application program for sum,multiplication, division and subtraction.

Related ASP.Net Topics :

Namespaces in Console Application
Constructor in Console Application

Subscribe us

If you liked this console application post, then please subscribe to our YouTube Channel for more video tutorials.

We hope that this post helped you to understand about console application example in C#.

Next, tutorial we will understand about Visual Studio.

Leave a Reply

Your email address will not be published. Required fields are marked *