title: A simple java program
body: <p>I have a problem statement</p>
  
  <p>Problem</p>
  
  <p>Write a program to calculate the sum of 2 numbers and print the output.</p>
  
  <p>Input</p>
  
  <p>Line 1: An integer.</p>
  
  <p>Line 2: An integer.</p>
  
  <p>Output :The output consists of a single integer which corresponds to sum, followed by a new line</p>
  
  <p>Sample Input I</p>
  
  <pre><code>3 
  1 
  </code></pre>
  
  <p>Sample Output I</p>
  
  <pre><code>4 
  </code></pre>
  
  <p>Sample Input II</p>
  
  <pre><code>13 
  10
  </code></pre>
  
  <p>Sample Output II</p>
  
  <pre><code>23
  </code></pre>
  
  <p>To which my solution is</p>
  
  <pre><code>import java.io.IOException;
  import java.util.InputMismatchException;
  import java.util.Scanner;
  
  public class Add {
  
  public static void main(String[] args)throws IOException
  {
      int a=0, b=0, sum;
      Scanner sc=new Scanner(System.in);
      System.out.println("Enter the numbers to be summed");
      try{
          a=sc.nextInt();
          sc.nextLine();
          b=sc.nextInt();
      }
      catch(InputMismatchException e){
          System.out.println("Please enter an Integer number");
          e.printStackTrace();}
      catch(Exception e){System.out.println(e);}
  
      sum=a+b;
  
      System.out.println(sum);
      sc.close();
  }
  
  }
  </code></pre>
  
  <p>I'm supposed to submit it to an online directory, that I assume tries to execute the program automatically. And when I do, it tells me</p>
  
  <p>Wrong Answer    Almost there,think some more</p>
  
  <p>I think pondering over it for an hour is more than enough before you decide to call in for reinforcement. </p>