NUMERO MAYOR DE 3




/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package numeromayor;
import java.util.Scanner;

/**
 *
 * @author bdb22
 */
public class Numeromayor {

      public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int n1, n2, n3;
      System.out.print("Introduzca primer número: ");
      n1 = sc.nextInt();
      System.out.print("Introduzca segundo número: ");
      n2 = sc.nextInt();
      System.out.print("Introduzca tercer número: ");
        n3 = sc.nextInt();
        if(n1 > n2)
           if(n1>n3)
              System.out.println("El mayor es: " + n1);
           else
              System.out.println("el mayor es: " + n3);
        else if(n2>n3)
              System.out.println("el mayor es: " + n2);
                else
              System.out.println("el mayor es: " + n3);
    }
}

Share this

Related Posts

Previous
Next Post »