diff --git a/tutorial-challenge-maior-tres/Main.java b/tutorial-challenge-maior-tres/Main.java new file mode 100644 index 0000000..d493be8 --- /dev/null +++ b/tutorial-challenge-maior-tres/Main.java @@ -0,0 +1,25 @@ +import java.util.Scanner; + +public class Main { + public static void main(String[] args) { + try (Scanner scanner = new Scanner(System.in)) { + System.out.println(" Informe Três Números:"); + int a = scanner.nextInt(); + int b = scanner.nextInt(); + int c = scanner.nextInt(); + int menor = a; + int maior = a; + + if (b > maior) + maior = b; + if (c > maior) + maior = c; + if (b < menor) + menor = b; + if (c < menor) + menor = c; + System.out.println(" Maior Número: " + maior + " Menor Número: " + menor); + } + } + +} diff --git a/tutorial-challenge-maior-tres/Readme.md b/tutorial-challenge-maior-tres/Readme.md new file mode 100644 index 0000000..e273450 --- /dev/null +++ b/tutorial-challenge-maior-tres/Readme.md @@ -0,0 +1,10 @@ +[pt-br] Usuário informa 3 números inteiros e programa retorna o maior e o menor deles. +Exemplo de entrada +11, 12, 13 +22, 22, 22 +32, 33, 33 + +Exemplo de saída +maior: 13, menor: 11; +números iguais; +maior: 33, menor: 32 \ No newline at end of file