0
Calculator on C#
Hi there, I just started C# and finished 'Conditionals and Loops' module. So, I wrote a basic calculator, which can add only 2 number: https://imgur.com/a/uZcDMRs Here is my question: how to write code that adds an infinite number of numbers?
3 Respostas
0
You want it to be like this?
1 + 1 = 2
2 + 2 = 4
3 + 3 = 6
...
0
I want to it be:
2+_
2+5_
2+5+7_
...
add a lot of numbers and place = where I want
0
In Python you would use an eval() method. Though in C# they dont have a method like that (as far as I know)
Luckily it's pretty easy to create one using the Compute method in the DataTable class😁
Here is an example, type in any sum that you want (addition, subtraction, multiplication etc.)
https://code.sololearn.com/cpIvP3b6KYxU/?ref=app