How to convert megabytes to terabytes in C#

1 Answer

0 votes
using System;
 
class Program
{
    static double MegabytesToTerabytes(long megabytes) {
        return (megabytes / 1024f) / 1024f;
    }
 
    static void Main()
    {
        int mb = 8459735;
         
        Console.WriteLine("{0:0.00}TB", MegabytesToTerabytes(mb));
    }
}
 
 
  
  
/*
run:
 
8.07TB
 
*/

 



answered Sep 14, 2020 by avibootz
...