# sum of even input numbers up to N | C programming

## Sum of even input numbers up to N

### Problem:

Read an integer value, which is a Natural number. Find the sum of even numbers up to N.#### Input

The input file contains an integer

**N**.#### Output

Print the sum of the even numbers up to N.### Solution

In C language:#include<stdio.h>

int main()

{

int N,i,sum;

scanf("%d",&N);

sum = 0;

for(i=0;i<=N;i=i+2){

sum = sum+i;

}

printf("%d\n",sum);

return 0;

}

### Discussion:

If you don't understand anything, ask in comment box.

## No comments