ARTICLE

Arithmetic calculator in Monodevelop

Posted by Deepak Dwij Articles | MonoDevelop October 23, 2011
In this article you will learn how to create a Arithmetic calclulator in Monodevelop.
Reader Level:
Download Files:
 

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.........

Login to add your contents and source code to this article
post comment
     
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
Get Career Advice from Experts
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.