Advertisement
cesarnascimento

ler 5 numeros e informar o maior for

May 30th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. package exercicios;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class ex7 {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner sc = new Scanner(System.in);
  9.         int num;
  10.         int maior = Integer.MIN_VALUE;
  11.        
  12.         for(int i = 0;i < 5;i++){
  13.             System.out.println("Digite o número: ");
  14.             num = sc.nextInt();
  15.            
  16.             if(num > maior){
  17.                 maior = num;
  18.             }
  19.         }
  20.         System.out.println("o maior é: "+maior);
  21.     }
  22.     /* César N. */
  23. }//faça um programa que leia 5 numeros e informe o maior
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement