Even number count from an integer : How to get the even number count from an integer input.

>      var intInput = 10;
Now i want the even count. In this case = 2+4+6+8+10 = 30

>     var evenCount = 0;
    if (i % 2==0) 
        {
            evenCount = evenCount + i;
        }

How to achieve this?