How to find the time complexities

This is a simple code I made. Can somebody tell me how to find the time complexity of this code?

Here is the code:

Code :

for(i = 0; i< n; i++)
for(j =1; sum = a[0]; j <= i; j++)
sum += a[j];
system.out.println (“sum of the array is” + sum);

Thank you....

Re: How to find the time complexities

What do you think the answer is? What happened when you wrote a few test programs to try it out yourself?

Re: How to find the time complexities

When looking at the complexity of code, you have to think, for a set of n elements, how long does this take to execute. Hint: the answer is not a fixed number. Hint#2: the number of lines in a loop doesn't change the complexity of the code necessarily, but the number of times you need to look through a set of n numbers can.