forked from bliblidotcom/training-java-future-program
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRecursion.java
More file actions
Latest commit
18 lines (16 loc) · 507 Bytes
/
Copy pathRecursion.java
File metadata and controls
18 lines (16 loc) · 507 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
publicclassRecursion{
publicstaticvoidmain(String[] args){
if(args.length != 1){
System.out.println("Usage: Recursion <number>");
}
intfact = Integer.parseInt(args[0]);
intjawab = 1;
jawab = count(fact);
System.out.println("Total perhiitungan adalah: "+jawab);
}
publicstaticintcount(intfact){
if(fact==1)return1;
inttotal = fact*count(fact-1);
returntotal;
}
}