#include<stdio.h>
int main()
{
int i=1,n,s=0;
printf("Enter number to set range : ");
scanf("%d",&n);
printf("\nEven numbers in range 1 to %d :\n\n",n);
for(i=1;i<=n;i++)
{
if(i%2==0)
{
printf("%d ",i);
s=s+i;
}
}
printf("\n\nSum of even numbers in range 1 to %d : %d",n,s);
return 0;
}