This question already has an answer here:
sum = 0; for (int i = 1; i <= n; i++ ) for (int j = 1; j <= i*i; j++) if (j % i ==0) for (int k = 0; k < j k++) sum++;
I am trying to find out time complexity of this above program.
First "for loop" will run n times.
Second for loop will execute overall n^3 times
The innermost loop will execute when j is multiple of i, that will happen exactly i times.
Please help me to find the overall time complexity of this program.