Project Euler #1: Multiples of 3 and 5

  • + 7 comments

    i am solving the question with c but i am unable to resolve the error of testcase 2 and 3 from my code my code. can any one help me ? my code is as follow:

     int T,i,k;
    int N,sum;
    scanf("%d",&T);
    for(i=0;i<T;i++)
        {
        sum=0;
        scanf("%d",&N);
        for(k=1;k<N;k++)
            {
            if(k%3==0||k%5==0)
            sum=sum+k;
        }
        printf("%d\n",sum);
    }