DragonA.
DragonA.
CC#
Created by DragonA. on 9/6/2024 in #help
Math.Round issue
I have strange issue with Math.Round in a first example I use it to round a double after calculation, and the output wrong, because it has to have 2 digits after dot, but the output have more digits after dot. string input = Console.ReadLine(); double r = double.Parse(input); const double pi = 3.14; double volume = 4 * pi * r * r * r / 3; Math.Round(volume, 2); Console.WriteLine($"volume: {volume}"); r = 2 volume: 33,49333333333333 In a second example I round first of all round the result and then give it to the variable and all working right. string input = Console.ReadLine(); double r = double.Parse(input); const double pi = 3.14; double volume = Math.Round(4 * pi * r * r * r / 3, 2); Console.WriteLine($"volume: {volume}"); r = 2 volume: 33,49 Why is it happen like that?
5 replies
CC#
Created by DragonA. on 10/10/2023 in #help
Create issue
No description
3 replies
CC#
Created by DragonA. on 9/13/2023 in #help
Seed for DB does't work
3 replies