UNA HERMOSA MOTO

UNA HERMOSA MOTO

miércoles, 22 de abril de 2015

Problema Propuesto 18


18.- DADO 02 NÚMEROS ENTEROS A Y B, DETERMINAR CUÁL ES MAYOR CON RESPECTO AL OTRO.

Resultado de imagen para A MAYOR QUE B

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

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
    int a,b;
            String X = "";

            Scanner teclado=new Scanner(System.in);
            System.out.print("1er Número(A):");
            a=teclado.nextInt();
            System.out.print("2do Número(B):");
            b=teclado.nextInt();
            
            if(a>b){
                  X = "A es mayor que B";
            }else{
                  if(b>a){
                     X = "B es Mayor que A";
                  }
            }
            if(a==b){
                  X = "A es igual a B";
                  }
            
            System.out.println("");
            System.out.println("EL RESULTADO ES: " +X);
      }
}

No hay comentarios:

Publicar un comentario