title: if-statement inside a try-catch block returns "Infinite"
body: <p>First of all i'm new to programming and just finished the Course on SoloLearn about C#.
  I do understand the core principal of try-catch blocks but i can't figure out how to correctly implement this in to my code(code shown below).</p>
  <pre><code>class Program
  {
      static void Main(string[] args)
      {   //create object of Class Calculator
          Calculator calc = new Calculator();
  
          //take user input and store in num1 and print it to screen
          try{
              double num1 = Convert.ToInt32(Console.ReadLine());
              Console.Write(&quot;\nnumber1: &quot; + num1);
              double num2 = Convert.ToInt32(Console.ReadLine());
              Console.Write(&quot;\nnumber2: &quot; + num2);
          
              //take operator as input and print it to screen
              string operand = Console.ReadLine();
              Console.Write(&quot;\noperator: &quot; + operand);
  
              //check if operator from user input is equal to one of the 4 calculation methods in Calculator Class
              Console.Write(&quot;\nresult: &quot;);
              if(operand == &quot;+&quot;){
              Console.WriteLine(calc.Addition(num1, num2));
              }
              else if(operand == &quot;-&quot;){
              Console.WriteLine(calc.Subtraction(num1, num2));
              }
              else if(operand == &quot;*&quot;){
              Console.WriteLine(calc.Multiplication(num1, num2));
              }
              else{
              Console.WriteLine(calc.Division(num1, num2));
              }
          }
          catch(DivideByZeroException){
              Console.WriteLine(&quot;can't divide by zero&quot;);
          }
          catch(Exception e){
              Console.WriteLine(&quot;An error occurred. Only integers are allowed!&quot;);
          } 
      }
  }//class Calculator with methods for 4 simple calculations
  class Calculator{
      private double number1;
      private double number2;
      private double res;
  
      public double Addition(double num1, double num2){
          this.number1 = num1;
          this.number2 = num2;
          this.res = num1 + num2;
          return res;
      }
      public double Subtraction(double num1, double num2){
          this.number1 = num1;
          this.number2 = num2;
          this.res = num1 - num2;
          return res;
      }
      public double Multiplication(double num1, double num2){
          this.number1 = num1;
          this.number2 = num2;
          this.res = num1 * num2;
          return res;
      }
      public double Division(double num1, double num2){
          this.number1 = num1;
          this.number2 = num2;
          this.res = num1 / num2;
          return res;
      }
  }
  </code></pre>
  <p>So i want my simple calculator to handle the exception &quot;DivideByZero&quot; and &quot;Exception e&quot; -&gt; if the input was not an integer.</p>
  <p>When i test the DivideByZero Exception with an example input of 4/0, the programm returns &quot;Infinite&quot; as a result instead of the code from the catch block.</p>
  <p>I guess the &quot;Infinite&quot; result comes from the if-statements inside the try-catch block but i'm not sure.</p>
  <p>I searched multiple sites, similar posts on stackoverflow and read the microsoft documentation for c# about try-catch blocks but i just can't figure it out.</p>
  <p>Sorry if my code sample is too big but i think this is the best way to understand my mess of code.</p>
  <p>Thank you in advance for the quick reply !</p>