Review
It seems that you are trying to make a simple calculator with number comparison in C#. There are some problems in this implementation.
ToInt32
:
Do you expect the input of calculation is always in int
format? How
about floating numbers?
Nah
method:
Naming:
I have no idea how's the name
Nah
imply the operation in the method. Something likerun
orperform
are better thanNah
.Integer Division:
Notice that the execution of
3 / 2
in this implementation is1
. It is a kind of integer division. Is the integer division result the correct output you expected?MessageBox.Show
Part:In C# 6, you can use string interpolation and make
MessageBox.Show("Sum of thenumbers entered is: " + (a + b));
intoMessageBox.Show($"Sum of thenumbers entered is: {(a + b)}");
. Interpolated strings are useful in string displaying and it's commonly used withConsole.WriteLine
orMessageBox.Show
.