Created
April 9, 2018 15:24
-
-
Save cheriimoya/8821ea968a62503ce3b3a07e546975f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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