C program to find sum of even numbers between 1 to n using for

#include<stdio.h>
int main()
{
	int i,n,sum=0;
	printf("Enter number for Even Sum: ");
	scanf("%d",&n);

	for(i=2;i<=n;i+=2)
	{
		sum += i;
	}

	printf("Sum of Even number: %d",sum);

	return 0;
}

Output

Enter number for Even Sum: 6
Sum of Even number: 12