I would like to know the time complexity of the following algorithm. At first glance the time complexity looks to be O(n^5) and that is what is mentioned in majority of the sites i have seen on the internet. But a careful analysis seems to give a different answer, here is the code:
public void fun(int n)
{
int i,j,k,sum=0;
for(i=0;i<n;i++)
{
for(j=0;j<i*i;j++)
{
if(j%i==0)
{
for(k=0;k<j;k++)
sum++;
}
}
}
}