class Program{ static int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } static void Main() { Console.Write("N = "); int n = int.Parse(Console.ReadLine()); int s = 0, p = 1, c = 0; while (n > 0) { s += n % 10; p *= n % 10; n /= 10; c++; } Console.WriteLine("Произведение: {0}", p); Console.WriteLine("Сумма: {0}", p); Console.WriteLine("Среднее: {0}", (double)s/c); // Вторая задача Console.Write("P = "); int P = int.Parse(Console.ReadLine()); Console.Write("Q = "); int Q = int.Parse(Console.ReadLine()); for (int i = 2; i <= 1 + 2*(int)Math.Sqrt(P); i++) { if (Q % i == 0 && gcd(P, i) == 1) Console.Write(i + " "); } Console.ReadLine(); }}