The following java program is showing runtime error(NZEC). Please help me to fix this.
import java.util.*;
class coins {
public static void main(String args[])
{
int i=10;
int n=0;
Scanner in=new Scanner(System.in);
while(i>0)
{
n=in.nextInt();
System.out.println(calc(n));
i--;
}
}
static int calc(int x)
{
if(((x%2)+(x%3)+(x%4))==0)
{
return (calc(x/2)+calc(x/3)+calc(x/4));
}
return x;
}
}