NCalc101 - Examples
Explore these examples to learn how to use NCalc101 for a variety of calculations. Try them out in your workspace or use them as templates for your own work!
Basic Arithmetic
7 + 5→ 1210 - 3→ 74 * 6→ 2420 / 4→ 52^5→ 32
Using Parentheses
(2 + 3) * 4→ 208 / (1 + 1)→ 4
Variables
a = 10b = 5a + b→ 15c = a * b→ 50
Functions
sqrt(25)→ 5sin(3.1416 / 2)→ 1log(100)→ 4.6052max(3, 7, 2)→ 7
Combining Features
x = 8y = sqrt(x) + 2→ 4z = (x + y) / 2→ 6
Error Handling
sqrt(-4)→ Error: Invalid input for sqrtunknownVar + 2→ Error: Variable not defined
Tips
- Use variables to simplify complex calculations.
- Try built-in functions for advanced math.
- Check the output for errors and variable values.
Experiment with these examples and create your own to get the most out of NCalc101!