Given a number n, the task is to complete the function which returns an integer denoting the smallest number evenly divisible by each number from 1 to n.I have solved it using the following function:long long getSmallestDivNum(long long n){   //number should be multiplier of n    bool found = true;    int i = 2;    while(1)    {        long long r = n*i;        found = true;        for(int j=2;j<=n;j++)        {            if( r % j != 0)            {                found  = false;            }        }        if(found != true)        {            i++;        }        else        {            return r;        }    }}But I am getting a time-limit-exceeded-error like this:Run Time Error Time Limit of 5 seconds exceeded.When I execute the code in my local NetBeans, it works fine with a runtime of 62ms.
Find the smallest divisible number for the given input 'n' such that number is evenly divisible by 1 to n
c++;algorithm;time limit exceeded