title: How can you round up a number and display it as a percentage?
body: <p>I'm a bit rusty on my mathematics so I hope someone can help me.  Using the code below I would like to do the following: Depending on the amount of memory installed, I would like to display the percentage of available memory and not how much is left in megabytes.</p>
  
  <pre><code>private void timer1_Tick(object sender, EventArgs e)
  {
      string memory;
      int mem;
      memory = GetTotalMemoryInBytes().ToString();
      mem = Convert.ToInt32(memory);
      mem = mem / 1048576; 
      progressBar2.Maximum = mem;
      progressBar2.Value = mem - (int)(performanceCounter2.NextValue());
      label2.Text = "Available Memory: " + (int)(performanceCounter2.NextValue()) + "Mb"; 
  
  
  }
  
  //using Microsoft visual dll reference in c#
  static ulong GetTotalMemoryInBytes()
  {
      return new Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory;
  }
  </code></pre>