forked from IPC1s2017/TareaFinal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEF1.java
More file actions
31 lines (23 loc) · 668 Bytes
/
Copy pathEF1.java
File metadata and controls
31 lines (23 loc) · 668 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package ef1;
/**
*
* @author lenovo
*/
public class EF1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println("Entra como argumento en args[0]=5 args[1]=4 args[2]=3 args[3]=2 args[4]=8");
int n = Integer.parseInt(args[0]);
System.out.println("Sale factorial de args[0]: ");
System.out.println(Factorial(n));
}
private static int Factorial(int n) {
if (n==0 || n==1)
return 1;
else {
return (Factorial(n-1)*n);
}
}
}