C Program to print the sum of n even numbers within range using for

Program

#include<stdio.h>
void main()
{
    int i;
    int start_range, end_range;
    int sum = 0;
    printf("Enter the starting range:\t");
    scanf("%d", &start_range);
    printf("Enter the ending range:\t");
    scanf("%d", &end_range);
    printf("Sum of even numbers in the given range is: ");
    for (i = start_range; i <= end_range; i++)
        if (i % 2 == 0)
            sum = sum + i;
    printf("%d",sum);
}

Output

$ gcc sum-of-n-even-numbers-within-range-using-for.c 
$ ./a.out
Enter the starting range:       20
Enter the ending range: 35
Sum of even numbers in the given range is: 216