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

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: ");
    i = start_range;
    do
    {
        if (i % 2 == 0)
            sum = sum + i;
        i++;
    } while (i <= end_range);
    printf("%d", sum);
}

Output

$ gcc sum-of-n-even-numbers-within-range-using-do-while.c 
$ ./a.out
Enter the starting range:       20
Enter the ending range: 30
Sum of even numbers in the given range is: 150