VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/how-to-make-a-calculator-in-c-sharp/

⇱ How to Make a Calculator in C# ? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to Make a Calculator in C# ?

Last Updated : 20 Jul, 2022

C# is an object-oriented, modern programming language that was created by Microsoft. It runs on the .NET Framework. C# is very close to C/C++ and Java programming languages. In this article, we will learn how to create a calculator in  C#. 

Basic Functions of Calculator:

  • Addition of two numbers.
  • Difference between two numbers.
  • Product of two numbers.
  • Division of two numbers.

Approach:

  • Declare local variables num1 and num2 for two numeric values.
  • Enter the choice.
  • Takes two numbers, num1, and num2.
  • do-while jump to an operator selected by the user.
  • Display the operation result.
  • Exit

Example:

Output:

Addition of two numbers:

👁 Image
 

Subtraction of two numbers:

👁 Image
 

Multiplication of two numbers:

👁 Image
 

Division of two numbers:

👁 Image
 
Comment
Article Tags:

Explore