title: How to calculate percentage in View Page of a MVC App in C#?
body: <p>My view currently looks similar to this:</p>
  
  <pre><code>@model IEnumerable&lt;MyViewModel&gt;
  
  &lt;div class="list-group"&gt;
  
      @foreach (var x in Model)
      {
          &lt;a href="#" class="list-group-item"&gt;
              @int passPercentage = x.PassCount/(x.FailedCount + x.Passcount)*100;
              &lt;span&gt;passPercentage&lt;/span&gt;
          &lt;/a&gt;
      }
  
  &lt;/div&gt;
  </code></pre>
  
  <p>But run-time fails telling 'invalid expression term int' (in the line where I calculate the passPercentage)</p>
  
  <p>One option I can think of is to calculate this percentage at the server side and pass on to the view.</p>
  
  <p>Are there any other alternatives If I wish to do this operation at client (view side) ?</p>