The way to analyze complexity of these nested loops is from the deepest loop.
for i = 1 to n
k[i] = 0
for i = 1 to n
for j = i to n
k[i] = k[i] +j
For the first loop it is very easy to see the operation k[i] = 0 will be performed n times
So order of that is O(N)
Now for the nested loop, loop for j starts from i , where i loops from 1 to n and continues till n.
So the key question to ask how many times the loop is executing.
when i = 1 it will be executing N times
when i = 2 it will be executing N-1 times
...
when i = 1 it will be executing 1 time
so if you sum them all it becomes N + N-1+ ... 1 = N(N-1)/2 = N^2/2 - N/2
So the order of the nested loop is O(N^2/2)- O(N/2) = O(N^2)
Also for the 1st loop the order is O(N)
so the total time complexity id O(N) + O(N^2) = O(N^2)