SHOW:
|
|
- or go back to the newest paste.
1 | using System; | |
2 | using System.Collections.Generic; | |
3 | using System.Linq; | |
4 | using System.Text; | |
5 | ||
6 | namespace ConsoleApplication16 | |
7 | { | |
8 | class Program | |
9 | { | |
10 | static void Main(string[] args) | |
11 | { | |
12 | int x; | |
13 | int sum = 0; | |
14 | ||
15 | ||
16 | int y; | |
17 | x = int.Parse(Console.ReadLine()); | |
18 | y = int.Parse(Console.ReadLine()); | |
19 | ||
20 | for (int i = x; i < y; i++) | |
21 | { | |
22 | - | sum = sum + i; |
22 | + | |
23 | if (sum %2 !=0 ) | |
24 | - | Console.WriteLine(sum); |
24 | + | sum = sum + i; |
25 | } | |
26 | ||
27 | Console.WriteLine(sum); | |
28 | ||
29 | ||
30 | } | |
31 | } | |
32 | } |