|
|
back to boardDiscussion of Problem 1068. SumЧто не так? C# Posted by IBets 20 Aug 2016 01:25 using System; using System.Collections.Generic; using System.Diagnostics; using System.Text; namespace Пример {
class Programm { static void Main(string[] args) { int num= int.Parse( Console.ReadLine());
int sum = 0; if (num<10000&&num>-10000) { if (num > 0) { for (int i = 1; i <= num; i++) { sum += i; } } else if (num < 0) { for (int i = num; i <= 1; i++) { sum += i; } } }
Console.WriteLine(sum); }
} } |
|
|