-1
// HELP ME OUT I M DEVELOPING A CALCULATOR WHICH CAN BE USED AGAIN AND AGAIN OVER NUMBER OF TIMES FOLLOWING IS THE CODING I'VE DONE PLZ INTIMATE THE MISTAKE AND HOW TO CORRECT

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

namespace ConsoleApplication1
{
    class CalculateNumber
    {

        int Number1, Number2;
        char option;
        int Result;

        public void Number()
        {
            Console.WriteLine("Enter the First number");
            Number1 = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter the second number");
            Number2 = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Main Menu");
            Console.WriteLine("1.Addition");
            Console.WriteLine("2.Subtraction");
            Console.WriteLine("3.Multiplication");
            Console.WriteLine("4.Division");

            Console.WriteLine("Enter the Operation you want to perform");
            option = Convert.ToChar(Console.ReadLine());

            while(1)
            {
            switch (option)
            {
                case '1':
                    Result = Number1 + Number2;
                    Console.WriteLine("The result of addition is:{0}", Result);
                    break;

                case '2':

                    Result = Number1 - Number2;
                    Console.WriteLine("The result of Subtraction is:{0}", Result);
                    break;

                case '3':

                    Result = Number1 * Number2;
                    Console.WriteLine("The result of Multiplication is:{0}", Result);
                    break;

                case '4':

                    Result = Number1 / Number2;
                    Console.WriteLine("The result of Division is:{0}", Result);
                    break;
                default:
                    Console.WriteLine("Invalid Option  ");
                    break;
            }
            }
        }
            Console.ReadLine();

        }
    }
    class ClassMain
    {
        static void Main(string[] args)
        {
            CalculateNumber obj = new CalculateNumber();
            obj.Number();
        }
    }

}


//THANKS

Edited by Dani: Formatting fixed

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by mshauny
0

Read your first post. I've showed you your mistake the and showed you how to do it correctly.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.