Created
July 10, 2018 06:48
-
-
Save tonkatsu7/909a308191a916c22b5fcbcb32a1767e to your computer and use it in GitHub Desktop.
CoderByte chalenge First Factorial
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
import java.util.*; | |
import java.io.*; | |
class Main { | |
public static int FirstFactorial(int num) { | |
return (num == 1) ? num : num * FirstFactorial(num - 1); | |
} | |
public static void main (String[] args) { | |
// keep this function call here | |
Scanner s = new Scanner(System.in); | |
System.out.print(FirstFactorial(s.nextLine())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment