Coding of calculator in C#

Coding of Calculator in C#

coding of calculator in C#, How to create calculator in C#
How to create Calculator
Dear Friend, I have shared here you C# program of Calculator. You Choose your Option and Do you calculation. It is very useful coding for beginner So Learns how to create Calculator or other Mathematical function. Best of luck.

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

namespace calculator
    class Program
        int num1;
        int num2;
        int result;
        char option;
        public void show()
            Console.WriteLine("1. Add two number");
            Console.WriteLine("2. Subtract two number.");
            Console.WriteLine("3. Multiplecation two num");
            Console.WriteLine("4. Division two number");
            Console.WriteLine("Choose your Option");
            opttion = Convert.ToChar(Console.ReadLine());

            Console.WriteLine("Enter your first number:");
            num1 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter your second number:");
            num2 = Convert.ToInt32(Console.ReadLine());

            switch (opttion)
                case '1':
                    result = num1 + num2;
                    Console.WriteLine("The result After add two number is:{0}", result);
                case '2':
                    result = num1 - num2;
                    Console.WriteLine("The result after  Abstraction of two num is:{0}", result);
                case '3':
                    Console.WriteLine("The result after multiplication of two num is:{0}", result);
                case '4':
                    Console.WriteLine("The result after Division is :{0}", result);
                    Console.WriteLine("Invalid option:");

        static void Main(string[] args)
            Program pd = new Program();

bust of luck

You can also see here an advance calculator coding 

No comments:

Related Posts Plugin for WordPress, Blogger...