a occhio...
codice:import java.io.*; class fattoriale { public static void main(String args[]) { int n=0; long ris=1; InputStreamReader input=new InputStreamReader(System.in); BufferedReader tastiera=new BufferedReader(input); String leggi; System.out.println("- PROGRAMMA FATTORIALE -Calcolo del fattoriale di un numero n -"); System.out.println("Inserire n "); try { leggi=tastiera.readLine(); n=Integer.valueOf(leggi).intValue(); } catch(Exception e) { } int j=n; while(j>1) { j--; ris*=j; } System.out.println(n + "!= " + ris + "."); } }

Rispondi quotando