Advertisement
Guest User

Untitled

a guest
May 20th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. import java.util.*;
  2. public class Massimoarray {
  3.  
  4.     public static void main(String[] args) {
  5.         Scanner leggi= new Scanner(System.in);
  6.         int array[];
  7.         array= new int [5];
  8.         int numeroMassimo=0;
  9.        
  10.         for(int i=0; i<5; i++)
  11.         {
  12.             System.out.print("inserisci i numeri:");
  13.             array[i]= leggi.nextInt();
  14.         }
  15.         for(int i=0; i<5; i++)
  16.         {
  17.            
  18.             if(numeroMassimo<array[i])
  19.             {
  20.                 numeroMassimo=array[i];
  21.                
  22.             }
  23.  
  24.            
  25.         }
  26.  
  27.         System.out.print(numeroMassimo);
  28.            
  29.  
  30.     }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement