Can't find the error (related to % ?)

1
2
3
4
5
  int a[21],i;
  a[0]=0; a[1]=1;
  for (i=2;i<=20;i++)
      a[i]=(7*a[i-1])%1000-(10*a[i-2])%1000+(pow(3,i))%1000;
Last edited on
% can only be used on integers but pow returns a double.
Thanks, changing it to int(pow(3,i)) gets rid of the problem.
Topic archived. No new replies allowed.