Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package retrete;
- import java.util.Scanner;
- public class retrete {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Scanner teclado = new Scanner(System.in);
- int n;
- n = teclado.nextInt();
- System.out.println("el factorial de n es: " + factorial(n));
- }
- public static int factorial (int n) {
- int aux = 1;
- for (int i = 2; i <= n; i++)
- aux *= i;
- return aux;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement