gnopaste

Sorry for this ugly message. We are searching for some translators.
Please send me an eMail or jabber: t4c@im.digital-bit.ch
Got: de, en, pl, ro, lu, ru, es - Need: everything else

Name
[java]Fattoriale
Scriptlanguage
Java
Tabwidth
4
Date
03/13/2010 01:37:48 pm
IP
151.32.237.64

[http://capiamoinsieme.bloog.it] Calcolo del fattoriale in modo ricorsivo

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/


package javaapplication1;
import java.util.*;

/**
*
* @author Administrator
*/

public class Fattoriale {

    public static long fattoriale(int n){
        if(n<=0) return 1;
        else return n*fattoriale(n-1);
    }
    public static void main(String[] args) {
    Scanner in=new Scanner(System.in);
    System.out.println("Digita un intero: ");
    int n=in.nextInt();
    System.out.println("Il fattoriale di "+n+"รจ: "+ fattoriale(n));
     
      }
    }

submitter » gnopaster | imprint « imprint     
» Terms of use «
» digital bit dot ch - t4c's new home «