Arithmetic calculator in Monodevelop


Introduction

This is a calculator which can calculate arithmetic operations like addition, subtraction, multiplication and division.

Steps for Creating the Calculator in the  Monodevelop IDE

Step 1 : Open monodevelop IDE --> file menu --> new solution --> then  select console Application-->rename as twonumber

Step 2: Modify the Code: 

// Program to Calculate the Arithmetic operations using C#
using System;
namespace twonumber
{
     class MainClass
     {
           public static void Main(string[] args)
           {
float first; float second; float output;
Console.WriteLine("         CAlCULATOR CHOICES");
Console
.WriteLine("*************************************");
Console
.WriteLine("  1.Addition");
Console
.WriteLine("  2.Substraction");
Console.WriteLine("  3.Multiplication");
Console.WriteLine("  4.Division");
Console.WriteLine("*************************************");
Console
.WriteLine("ENTER YOUR CHOICE");
int a = Convert.ToInt32(Console.ReadLine());
switch
(a)
{
      case
1:
            Console.WriteLine("Enter First Number  :");
                  first = Convert.ToInt64(Console.ReadLine());
          Console.WriteLine("Enter Second Number :");
          second = Convert.ToInt64(Console.ReadLine());
          output = first + second;
                  Console
.WriteLine("ADDTION OF TWO INPUT NUMBERS: " + output); break;
      case 2:
  Console
.WriteLine("Enter First Number  :");
  first = Convert.ToInt64(Console.ReadLine());
  Console
.WriteLine("Enter Second Number :");
  second = Convert.ToInt64(Console.ReadLine());
  Console
.WriteLine("SUBSTRACTION OF TWO INPUT NUMBERS: " + output); break;
      case
3:
  Console
.WriteLine("Enter First Number  :");
          first = Convert.ToInt64(Console.ReadLine());
  Console
.WriteLine("Enter Second Number :");
  second = Convert.ToInt64(Console.ReadLine());
  output = first * second;
  Console
.WriteLine("MULTIPLICATION OF TWO INPUT NUMBERS: " + output); break;
     case
4:
  Console
.WriteLine("Enter First Number  :");
  first = Convert.ToInt64(Console.ReadLine());
  Console
.WriteLine("Enter Second Number :");
  second = Convert.ToInt64(Console.ReadLine());
  output = first / second;
          Console.WriteLine("DIVISION OF TWO INPUT NUMBERS: " + output); break;
                          default: Console.WriteLine("Invalid choice !"); break;
}
Console.WriteLine("***************************************");
console
.WriteLine("Thanks you  !! DEEPAK DWIJ !!"); Console.Read();
          }
     }
}


Step3:
To Run  F5

Step 4 :
Ouput

Enter Your choice

1.gif

Enter your input

2.gif

Final Result

3.gif 

Note: Same Process for Subtraction, multiply and Division.........

Up Next
    Ebook Download
    View all
    Learn
    View all