Skip to content

Instantly share code, notes, and snippets.

@cheriimoya
Created April 9, 2018 15:24
Show Gist options
  • Save cheriimoya/8821ea968a62503ce3b3a07e546975f3 to your computer and use it in GitHub Desktop.
Save cheriimoya/8821ea968a62503ce3b3a07e546975f3 to your computer and use it in GitHub Desktop.
public class Main {
public static void main(String[] args) {
System.out.println("fakuiter ist: " + fakuIter(4));
System.out.println("fakureku ist: " + fakuReku(4));
}
static int fakuIter(int n){
int ergebnis = 1;
for (int i = 1; i <= n; i++) {
ergebnis *= i;
}
return ergebnis;
}
static int fakuReku(int n){
if (n == 1)
return n;
return n*fakuReku(n-1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment