Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package pruebas;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11.  *
  12.  * @author MasterRace
  13.  */
  14. public class Pruebas {
  15.  
  16.     /**
  17.      * @param args the command line arguments
  18.      */
  19.     public static void main(String[] args) {
  20.         Scanner teclado = new Scanner(System.in);
  21.         int x=0;
  22.         int y=0;
  23.         System.out.println("Introduce x: ");
  24.         x = teclado.nextInt();
  25.         System.out.println("Introduce y: ");
  26.         y = teclado.nextInt();
  27.         System.out.println(suma(x,y));
  28.        
  29.         int i=0;
  30.         int j=0;
  31.         System.out.println("Introduce i: ");
  32.         i = teclado.nextInt();
  33.         System.out.println("Introduce j: ");
  34.         j = teclado.nextInt();
  35.         System.out.println(suma(i,j));
  36.     }
  37.    
  38.     public static int suma(int x, int y)
  39.     {
  40.            return x+y;
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement