UNA HERMOSA MOTO

UNA HERMOSA MOTO

miércoles, 22 de abril de 2015

Problema Popuesto 01



01.- Hallar a + b y a - b

Resultado de imagen para a + b

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package problema11;
import java.io.*;
/**
 *
 * @author abel montalvan
 */
public class Problema11 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        int a,b,n1,n2;
    BufferedReader in =new BufferedReader(new  InputStreamReader(System.in));
 System.out.println("Número1: ");
        a=Integer.parseInt(in.readLine());
 System.out.println("Número2: ");
        b=Integer.parseInt(in.readLine());

        n1=a+b;
        n2=a-b;
        
    
      System.out.println("");
      System.out.println("Suma: " + n1);
      System.out.println("Resta: " + n2);
        
        // TODO code application logic here
    }
}

No hay comentarios:

Publicar un comentario