Exercises: Simple Calculations

Let's strengthen the knowledge gained throughout this chapter with a few more exercises.

What We Learned in This Chapter?

Let's summarize what we learned in this chapter of the book:

  • Inserting a text: var str = Console.ReadLine();
  • Inserting an integer: var num = int.Parse(Console.ReadLine());
  • Inserting a float number: var num = double.Parse(Console.ReadLine());
  • Calculations with numbers and using the suitable arithmetic operators [+, -, *, /, ()]: var sum = 5 + 3;
  • Printing a text by placeholders on the console: Console.WriteLine("{0} + {1} = {2}", 3, 5, 3 + 5);

The Exercises

We have a lot of practical work. Solve these exercises to learn how to work with variables and data types, reading and writing at the console, using data and calculations:

results matching ""

    No results matching ""