Exercises: Simple Calculations
Let's strengthen the knowledge gained throughout this chapter with a few more exercises.
Video: Chapter Summary
Watch the following video to summarize what we learned in this chapter: https://youtu.be/Zv_c-M_7Gyw.
What We Learned in This Chapter?
Let's summarize what we learned in this chapter:
- Reading a text:
var str = Console.ReadLine();
- Reading an integer:
var num = int.Parse(Console.ReadLine());
- Reading a floating-point 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 on the console, using data and calculations:
- Blank Visual Studio Solution
- Problem: Calculating Square Area
- Problem: Inches to Centimeters
- Problem: Greeting by Name
- Problem: Concatenating Text and Numbers
- Problem: Trapezoid Area
- Problem: Circle Area and Perimeter
- Problem: Rectangle Area
- Problem: Triangle Area
- Problem: Console Converter – from °C Degrees to °F Degrees
- Problem: Console Converter – from Radians to Degrees
- Problem: Console Converter – USD to BGN
- Problem: * Console Currency Converter
- Problem: ** Date Calculations