title: Code optimization for pythagoras theorem
body: <p>could anyone help me with the following code :</p>
  
  <pre><code>import java.math.*;
  import java.util.Scanner;
  
  public class Pitagor {
  public static void main (String[] args){
      System.out.println(pitagor(in1(),in2()));
  
  }
  public static int in1 (){
      Scanner input = new Scanner(System.in);
      System.out.println("Eingabe von a  ");
      int a = input.nextInt();
  
      return a;
  }
  public static int in2 (){
      Scanner input = new Scanner(System.in);
      System.out.println("Eingabe von b");
      int b = input.nextInt();
  
      return b;
  }
  public static double pitagor (int x , int y){
      double c = Math.sqrt((x*x)+(y*y));
      return c;
  }
  }
  </code></pre>
  
  <p>My goal here is to make the code simpler by using separate methods for input and calculation, but i can't seem to understand how to make only one input method instead of <em>in1()</em> and <em>in2()</em>.</p>
  
  <p>What i tried was :</p>
  
  <pre><code>public static void in (){
  Scanner input = new Scanner(System.in);
  System.out.println("Eingabe von a  ");
  int a = input.nextInt();
  Scanner input = new Scanner(System.in);
  System.out.println("Eingabe von b");
  int b = input.nextInt(); }
  </code></pre>
  
  <p>but i don't know how to get <em>a</em> and <em>b</em> from this method, so i can use them in </p>
  
  <blockquote>
    <p>pitagor (int x , int y)</p>
  </blockquote>
  
  <p>Thanks in advance.</p>