Hi for everybody,
i'm trying to do this code - small factorials,
but my compiling result is runtime error (NZEC)
ID: 834036
My code is bellow, can someone help me? thanks
import java.util.*;
import java.io.*;
public class Main
{
public static long factorial( long number )
{
if( number <= 1)
return 1;
else
return number*factorial( number-1);
}
public static void main(String args[]) throws Exception
{
Scanner cin=new Scanner(System.in);
int n=cin.nextInt();
int i=1;
while(i<=n)
{
int a=cin.nextInt();
System.out.printf("%d\n",factorial(a));
}
}
}