title: How to prevent division by zero?
body: <pre><code>ads = ads.Where(x =&gt; (x.Amount - x.Price) / (x.Amount / 100) &gt;= filter.Persent);
  </code></pre>
  
  <p>if x.Amount == 0 I have error "Divide by zero error encountered."</p>
  
  <p>like me in this request is to avoid?</p>
  
  <p><strong>update:</strong></p>
  
  <p>this helped, but I do not like the decision:</p>
  
  <pre><code>ads = ads.Where(x =&gt; (x.Amount - x.Price) / ((x.Amount / 100)==0?0.1:(x.Amount / 100)) &gt;= filter.Persent);
  </code></pre>
  
  <p>there is another way?</p>