runtime error(SIGSEGV) in byteland coins ques. Please help.

The following program is showing runtime error(SIGSEGV). Please help me to fix this.

#include<stdio.h>
int main()
{
int i=10;
int n;
while(i--)
{
    scanf("%d",&n);
    printf("%d\n",calc(n));
}
return 0;
}
int calc(int x)
{
  if(((x%2)+(x%3)+(x%4))==0)
{
    return (calc(x/2)+calc(x/3)+calc(x/4));
}
return x;
}

use : while(scanf("%d",&n)) instead of i-- and remove the variable i. This should remove all runtime errors!