Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package taller1nocalificable;
- import java.util.Scanner;
- public class Pregunta13 {
- int a = 0, b = 0, c = 0;
- public void leerNum(){
- Scanner entrada = new Scanner(System.in);
- System.out.print("Ingrese el primer numero: ");
- a = entrada.nextInt();
- System.out.print("Ingrese el segundo numero: ");
- b = entrada.nextInt();
- System.out.print("Ingrese el tercer numero: ");
- c = entrada.nextInt();
- }
- public void ordenar(){
- if((a == b) && (a == c)){
- System.out.println(a +", " +b +" y " +c +" son tres numero iguales");
- }else{
- if((a > b) && (b > c)){
- System.out.println("Mayor a menor: " +a +", " +b +", " +c);
- System.out.println("Menor a mayor: " +c +", " +b +", " +a);
- }else{
- if((a > c) && (c > b)){
- System.out.println("Mayor a menor: " +a +", " +c +", " +b);
- System.out.println("Menor a mayor: " +b +", " +c +", " +a);
- }else{
- if((a > b) && (b == c)){
- System.out.println("Mayor a menor: " +a +", " +b +", " +c);
- System.out.println("Menor a mayor: " +c +", " +b +", " +a);
- }else{
- if((b > a) && (a > c)){
- System.out.println("Mayor a menor: " +b +", " +a +", " +c);
- System.out.println("Menor a mayor: " +c +", " +a +", " +b);
- }else{
- if((b > c) && (c > a)){
- System.out.println("Mayor a menor: " +b +", " +c +", " +a);
- System.out.println("Menor a mayor: " +a +", " +c +", " +b);
- }else{
- if((b > a) && (a == c)){
- System.out.println("Mayor a menor: " +b +", " +a +", " +c);
- System.out.println("Menor a mayor: " +c +", " +a +", " +b);
- }else{
- if((c > a) && (a > b)){
- System.out.println("Mayor a menor: " +c +", " +a +", " +b);
- System.out.println("Menor a mayor: " +b +", " +a +", " +c);
- }else{
- if((c > b) && (b > a)){
- System.out.println("Mayor a menor: " +c +", " +b +", " +a);
- System.out.println("Menor a mayor: " +a +", " +b +", " +c);
- }else{
- if((c > a) && (a == b)){
- System.out.println("Mayor a menor: " +c +", " +a +", " +c);
- System.out.println("Menor a mayor: " +c +", " +b +", " +a);
- }else{
- if((a < b) && (b == c)){
- System.out.println("Mayor a menor: " +b +", " +c +", " +a);
- System.out.println("Menor a mayor: " +a +", " +c +", " +b);
- }else{
- if((b < a) && (a == c)){
- System.out.println("Mayor a menor: " +a +", " +c +", " +b);
- System.out.println("Menor a mayor: " +b +", " +c +", " +a);
- }else{
- if((c < a) && (a == b)){
- System.out.println("Mayor a menor: " +a +", " +b +", " +c);
- System.out.println("Menor a mayor: " +c +", " +b +", " +a);
- }else{
- System.err.println("Hubo un error en el ingreso de los datos");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- public static void main(String[] args) {
- Pregunta13 obj = new Pregunta13();
- obj.leerNum();
- obj.ordenar();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement