【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);
                }
            }
        }

版权声明:本文为 NoMasp柯于旺 原创文章,未经许可严禁转载!欢迎访问我的博客:http://blog.csdn.net/nomasp

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