Sum of even numbers from 1 to N
Rust
Easy
loops
Task «Sum of even numbers from 1 to N»
Write a program that reads a positive integer N (N ≥ 1) from the keyboard and outputs the sum of all even numbers from 1 to N inclusive. Use a loop to iterate through the numbers.
Input Format
One 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.rs