Printing the Result

Finally, we have to print the result on the console. We notice that the number has to be rounded to the second decimal point. In order to do that, we can use a placeholder - a place that will be replaced by a paricular value when printing. In C#, a digit surrоunded by curly brackets, is used for a placeholder. As in programming counting starts from 0, the expression {0} means that it will be replaced by the first given argument. An integer or a floating-point number we can format by using F or f. That is followed by a whole positive number, which specifies the number of digits after the point (you can read more about formatting here: (Svetlin Nakov, Veselin Kolev and team: "Programming Basics with C#", page. 155-158):

Test in the Judge system

Test your solution here:

results matching ""

    No results matching ""