Summary
Congratulations! You've learned how to work with data and perform operations in C#. Here's what you've covered:
Key concepts
- Numeric data types —
intfor whole numbers,decimalfor precise decimals (like money),doublefor general decimal calculations - Arithmetic operators —
+,-,*,/, and%for basic math - Order of operations — C# follows PEMDAS; use parentheses to control it
- Compound assignment —
+=,-=,*=,/=for updating a variable - Increment and decrement —
++and--for adding or subtracting 1 - Type conversion —
Convert.ToInt32(),Convert.ToDecimal(), casts like(int)and(decimal) - User input conversion — always convert
Console.ReadLine()values before using them for math
What you can now do
- Choose the right data type for your calculations
- Perform arithmetic operations on numeric variables
- Convert user input from strings to numbers
- Build interactive programs that calculate results
Keep practicing! Modify the tip calculator and temperature converter you built to add new features. The more code you write, the more comfortable you'll become.
Get a free verified certification
Microsoft and freeCodeCamp.org offer a training and certification combo on foundational C#. By completing this Learn module, you're already started. Explore freeCodeCamp's Foundational C# with Microsoft certification here: https://aka.ms/csharp-certification.