Sum the Multiples of 3 and 5 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below N.

  #include &lt;stdio.h&gt;
  int main(){
    int i=0,j,k,l,sum=0;
    scanf(&quot;%d&quot;,&amp;i);
    if(i&lt;=100000&amp;&amp;i&gt;0){
    for(j=0;j&lt;i;j++){
        scanf(&quot;%d&quot;,&amp;k);
        if(k&lt;=1000000000&amp;&amp;k&gt;0){
        for(l=3;l&lt;k;l++){
            if(l%3==0||l%5==0)
                {sum+=l;}
        }}
    printf(&quot;%d\n&quot;,sum);
    sum=0;
    }}

The above code does satisfy all the test cases but it has been rejected citing that it is very slow. Please suggest improvements to the code.
Generally, try to think about the problem before brute-forcing it. 

Is there an easy way to sum all the multiples of 3 below \$N\$? Of course there is. 
First we note that the largest multiple of 3 is \$3 * \lfloor\frac{N}{3}\rfloor\$ and the sum of all the multiples is then \$3 * 1 + 3 * 2 + ... 3 * \lfloor\frac{N}{3}\rfloor\$. Factor out the 3 and you get \$3 * (1 + 2 + 3 + ... \lfloor\frac{N}{3}\rfloor)\$. Now we use Gauss's trick for summing the natural numbers to get a nice easy formula for the sum: \$3*x*\frac{x+1}{2}\$, where \$x\$ is \$\lfloor\frac{N}{3}\rfloor\$.

Similarly, we can get the sum for the multiples of 5, and add the results together. However, we then have a bunch of duplicates (namely multiples of 15)
which we can also calculate in a similar manner and then subtract to get the final result.

This approach completely eliminates any and all looping, and so will be super quick.

Now, let's discuss your code. Here's a list of suggestions:


If you are prompting the user, provide some helpful hints as to what you are expecting as input.
Having hardcoded bounds such as yours is unintuitive. Have your sum be a long or even long long (depending on the desired platform) and you will not run into issues with integer inputs, which are guaranteed by scanf(%d). This will also cut down on the indentation, increasing readability.
Variable names are important. While it is pretty easy to see that i, k are the bounds, and j, l are counter variables after reading the code, it would be even easier to understand with lower_bound, upper_bound and i, j for the counters (per standard practices).
Consider generalizing the problem to create a function that will be reusable elsewhere.