Introduction

Here is a Windows Forms app that creates a Simple Arithmetic Calculator UI app using .NET and C#.
Sample Program
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace calculator1
  10. {
  11. public partial class Form1 : Form
  12. {
  13. int a=0;
  14. int b,c;
  15. string msg;
  16. public Form1()
  17. {
  18. InitializeComponent();
  19. }
  20. private void Form1_Load(object sender, EventArgs e)
  21. {
  22. }
  23. private void b1_Click(object sender, EventArgs e)
  24. {
  25. t1.Text = t1.Text + b1.Text;
  26. }
  27. private void b2_Click(object sender, EventArgs e)
  28. {
  29. t1.Text = t1.Text + b2.Text;
  30. }
  31. private void b3_Click(object sender, EventArgs e)
  32. {
  33. t1.Text = t1.Text + b3.Text;
  34. }
  35. private void b5_Click(object sender, EventArgs e)
  36. {
  37. t1.Text = t1.Text + b5.Text;
  38. }
  39. private void b6_Click(object sender, EventArgs e)
  40. {
  41. t1.Text = t1.Text + b6.Text;
  42. }
  43. private void b7_Click(object sender, EventArgs e)
  44. {
  45. t1.Text = t1.Text + b7.Text;
  46. }
  47. private void b9_Click(object sender, EventArgs e)
  48. {
  49. t1.Text = t1.Text + b9.Text;
  50. }
  51. private void b10_Click(object sender, EventArgs e)
  52. {
  53. t1.Text = t1.Text + b10.Text;
  54. }
  55. private void b11_Click(object sender, EventArgs e)
  56. {
  57. t1.Text = t1.Text + b11.Text;
  58. }
  59. private void b13_Click(object sender, EventArgs e)
  60. {
  61. t1.Text = t1.Text + b13.Text;
  62. }
  63. private void b4_Click(object sender, EventArgs e)
  64. {
  65. a = Convert.ToInt32(t1.Text);
  66. t1.Text = "";
  67. msg = "+";
  68. }
  69. private void b8_Click(object sender, EventArgs e)
  70. {
  71. a = Convert.ToInt32(t1.Text);
  72. t1.Text = "";
  73. msg = "-";
  74. }
  75. private void b12_Click(object sender, EventArgs e)
  76. {
  77. a = Convert.ToInt32(t1.Text);
  78. t1.Text = "";
  79. msg = "*";
  80. }
  81. private void b15_Click(object sender, EventArgs e)
  82. {
  83. a = Convert.ToInt32(t1.Text);
  84. t1.Text = "";
  85. msg = "/";
  86. }
  87. private void b16_Click(object sender, EventArgs e)
  88. {
  89. t1.Text = "";
  90. }
  91. private void b14_Click(object sender, EventArgs e)
  92. {
  93. if (msg == "+")
  94. {
  95. b = Convert.ToInt32(t1.Text);
  96. c = a + b;
  97. }
  98. if (msg == "-")
  99. {
  100. b = Convert.ToInt32(t1.Text);
  101. c = a - b;
  102. }
  103. if (msg == "*")
  104. {
  105. b = Convert.ToInt32(t1.Text);
  106. c = a * b;
  107. }
  108. if (msg == "/")
  109. {
  110. b = Convert.ToInt32(t1.Text);
  111. c = a / b;
  112. }
  113. t1.Text = c.ToString();
  114. }
  115. }
  116. }

Explanation


The UI of the Simple Arithmetic Calculator looks like the following where you can see, there is a button for numbers and operators. Just run the program, select your numbers and operators and run it.
Simple Calculator using .NET Window Application