/* © MATTO MATTI 2017 http://mattomatti.com/pl/a0006 napisane przy użyciu Visual Studio Community 2015 2017-01-03 v 1.0 */ using System; namespace plcode1cs { class Program { static bool czyZachwycająca(int n) { int[] dzielniki = new int[n / 2]; int suma = 0, ile = 0; for (int i = 1; i <= n / 2; i++) { if (n % i == 0) { suma += i; dzielniki[ile++] = i; } } for (int i = 0; i < ile; i++) { if (n == suma - 2 * dzielniki[i]) { return true; } } return false; } static void Main(string[] args) { for (int i = 1; i <= 100; i++) { if (czyZachwycająca(i)) { Console.WriteLine(i); } } Console.ReadKey(); } } }