fork(1) download
  1. import java.util.Scanner;
  2.  
  3. class Ideone {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6. System.out.println(" Tres nĂºmeros:");
  7. int a = sc.nextInt();
  8. int b = sc.nextInt();
  9. int c = sc.nextInt();
  10. int menor = a;
  11. int maior = a;
  12. if (b > maior) maior = b;
  13. if (c > maior) maior = c;
  14. if (b < menor) menor = b;
  15. if (c < menor) menor = c;
  16. System.out.println(" Maior: " + maior + " Menor: " + menor);
  17. }
  18. }
  19.  
  20. //https://pt.stackoverflow.com/q/110753/101
Success #stdin #stdout 0.14s 37724KB
stdin
3
1
5
stdout
 Tres números:
 Maior: 5 Menor: 1