示例#1
0
        public List <int> GetNumerosPrimos(string value)
        {
            var primos = new Primos(value);

            if (primos.Invalid)
            {
                throw new ArgumentException(string.Join(",", primos.Notifications.Select(x => x.Message.ToString()).ToArray()));
            }

            return(primos.Calculate());
        }
示例#2
0
        public List <dynamic> Getint(string value)
        {
            var primos    = new Primos(value);
            var divisores = new Divisor(value);

            if (primos.Invalid)
            {
                throw new ArgumentException(string.Join(",", primos.Notifications.Select(x => x.Message.ToString()).ToArray()));
            }

            if (divisores.Invalid)
            {
                throw new ArgumentException(string.Join(",", divisores.Notifications.Select(x => x.Message.ToString()).ToArray()));
            }

            return(new List <dynamic> {
                new { divisores = divisores.Calculate(), primos = primos.Calculate() }
            });
        }
示例#3
0
        public static void Divisores(string value)
        {
            var divisores = new Divisor(value);
            var primos    = new Primos(value);

            if (divisores.Invalid)
            {
                Console.WriteLine(string.Join(",", divisores.Notifications.Select(x => x.Message.ToString()).ToArray()));
                return;
            }

            var result = divisores.Calculate();

            Console.WriteLine("Divisores: " + string.Join(",", result.Select(x => x.ToString()).ToArray()));

            var resultPrimo = primos.Calculate();

            Console.WriteLine("Divisores Primos: " + string.Join(",", resultPrimo.Select(x => x.ToString()).ToArray()));
        }