【Project Euler】5 第五题



//2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
//What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

        static void Main(string[] args)
        {
            for(int j=1;j<1000000000;j++)
            {
                int count = 0;
                for(int i=1;i<21;i++)
                {
                    if(j%i==0)
                    {
                        count += 1;
                    }
                }
                if(count==20)
                {
                    Console.WriteLine(j);
                }
            }
        }

你可能感兴趣的:(【Project Euler】5 第五题)