Here the key thing is :
k is initialised only once outside while loop
So lets analyse for different values of 'i'..
When i = 0 , i.e. first loop iteration , k runs logn times [ as we have right shift operation which is same as division by 2 ]
So eventually k becomes 1 and it exits from inner loop..
From next value of 'i' , i.e. next outer loop iteration , since 'k' is not reinitialised so condition "k > 1" is checked which becomes false so it does not enter into inner loop at all..
So is the case for all upcoming values of 'i'..
Hence time complexity = O(logn) + O(1) .....[n-1] times
= O(logn) + n - 1
= O(n)
Hence the time complexity of the given program should be O(n) ..