|
|
вернуться в форумWhat`s wrong? using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _1068 { class Program { static void Main(string[] args) { int number = int.Parse(Console.ReadLine()); int result = 0; if (number > 10000 || number < -10000) throw new Exception("BAD!!!"); if (number > 0) for (int i = 1; i <= number; i++) { result += i; } if (number < 0) for (int i = 1; i >= number; i--) { result += i; } Console.WriteLine(result); } } } |
|
|