Advertisement
chete

retrete.java

Mar 25th, 2014
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. package retrete;
  2. import java.util.Scanner;
  3. public class retrete {
  4.  
  5.     public static void main(String[] args) {
  6.         // TODO Auto-generated method stub
  7.         Scanner teclado = new Scanner(System.in);
  8.         int n;
  9.         n = teclado.nextInt();
  10.         System.out.println("el factorial de n es: " + factorial(n));
  11.     }
  12.     public static int factorial (int n) {
  13.         int aux = 1;
  14.         for (int i = 2; i <= n; i++)
  15.             aux *= i;
  16.         return aux;
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement