We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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);
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #1: Multiples of 3 and 5
You are viewing a single comment's thread. Return to all 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: