You are viewing a single comment's thread. Return to all comments →
Here's my simple solution in Java:
import java.util.*; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println( factorial(scan.nextInt()) ); } public static long factorial( int n ) { return (n == 1) ? 1 : n*factorial(n-1) ; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 9: Recursion 3
You are viewing a single comment's thread. Return to all comments →
Here's my simple solution in Java: