int total = 0; for (int i = 1; i <= 100; i++) { if (i % 2 != 0) { total += i; } } Console.WriteLine(total); Console.ReadLine()