Sum of even numbers from 1 to N
Java
Easy
math
Task «Sum of even numbers from 1 to N»
Write a program that calculates the sum of all even numbers from 1 to a given number N inclusive. If N is less than 2, the sum is considered equal to 0. The number N is a natural number and does not exceed 1000.
Input Format
Integer N (1 ≤ N ≤ 1000).
Output Format
One integer — the sum of even numbers from 1 to N.
Examples
Example 1
INPUT
10
OUTPUT
30
Example 2
INPUT
1
OUTPUT
0
main.java