title: C# biggest of 5 numbers only with If/else
body: <p>While doing some C# exercises got stuck on this one.</p>
  
  <p>// Finding the biggest of five numbers by using only <strong>five</strong> if statements. </p>
  
  <p>I couldn't get how to make that, so I looked up online I set this up. </p>
  
  <pre><code>    Console.Write("Type number 1:");    double a = double.Parse(Console.ReadLine());
      Console.Write("Type number 2:");    double b = double.Parse(Console.ReadLine());
      Console.Write("Type number 3:");    double c = double.Parse(Console.ReadLine());
      Console.Write("Type number 4:");    double d = double.Parse(Console.ReadLine());
      Console.Write("Type number 5:");    double e = double.Parse(Console.ReadLine());
  
      double max;
      if (a &gt; b &amp;&amp; a &gt; c &amp;&amp; a &gt; d &amp;&amp; a &gt; e)
      {
          max = a;
          Console.WriteLine("The biggest number from {0} , {1} and {2} is {3}.", a, b, c, max);
      }
      else if (b &gt; a &amp;&amp; b &gt; c &amp;&amp; b &gt; d &amp;&amp; b &gt; e)
      {
          max = b;
          Console.WriteLine("The biggest number from {0} , {1} and {2} is {3}.", a, b, c, max);
      }
      else if (c &gt; a &amp;&amp; c &gt; b &amp;&amp; c &gt; d &amp;&amp; c &gt; e)
      {
          max = c;
          Console.WriteLine("The biggest number from {0} , {1} and {2} is {3}.", a, b, c, max);
      }
      else if (d &gt; a &amp;&amp; d &gt; b &amp;&amp; d &gt; c &amp;&amp; d &gt; e)
      {
          max = d;
          Console.WriteLine("The biggest number from {0} , {1} and {2} is {3}.", a, b, c, max);
      }
      else
      {
          max = e;
          Console.WriteLine("The biggest number from {0} , {1} and {2} is {3}.", a, b, c, max);
      }
  </code></pre>
  
  <p>Using the exercise examples it returns correct data. For example</p>
  
  <pre><code>5   2   2   4   1   return: 5
  </code></pre>
  
  <p>But after further testing I ended up that it's wrong:</p>
  
  <pre><code>-1  -2  -2  -1  -15 return: -15
  </code></pre>
  
  <p>Either my first grade math skills are wrong or -15 isn't bigger than -1. I know where the mistake is but I don't know how to actually fix it.</p>