I need to split a number with decimal places.
An example: I need to do 14525/1024/1024 but in my application, it says
0 MB
How to calculate 14525/1024/1024 to
00,01 MB
like
40.61 MB
(I need to convert bytes to megabytes)
I need to split a number with decimal places.
An example: I need to do 14525/1024/1024 but in my application, it says
0 MB
How to calculate 14525/1024/1024 to
00,01 MB
like
40.61 MB
(I need to convert bytes to megabytes)
You need to use decimal and not int:
decimal result = Math.Round((decimal)14525 / 1024 / 1024, 2);