Attachment 'DeterminaMax.java'

Download

   1 import javax.swing.JOptionPane;
   2 
   3 
   4 public class DeterminaMax {
   5 
   6 	public static void main(String[] args) {
   7 		
   8 		boolean continua=true;
   9 		int max=0;
  10 		
  11 		while(continua)
  12 		{
  13 			String valore=JOptionPane.showInputDialog("Inserisci un numero");
  14 			
  15 			int numero=Integer.parseInt(valore);
  16 			
  17 			if(numero<0)
  18 			{
  19 				continua=false;
  20 			}
  21 			else
  22 			{
  23 				if(numero>max)
  24 				{
  25 					max=numero;
  26 				}
  27 							
  28 			}
  29 		}
  30 		JOptionPane.showMessageDialog(null, "Il massimo numero letto รจ "+max);
  31 	}
  32 }

Attached Files

You are not allowed to attach a file to this page.