0 votes 0 votes n is prime ,find value of x and find time complexity. main() { x=0; for(i=1;i<=n;i++) { if(n%i) { for(j=1;j<=n;j=j*10) { x=x+1; } } } } what i am getting is x=(n-2)logn tym complexity =n+(n-2)log n. is correct ? Algorithms time-complexity algorithms + – eyeamgj asked Nov 17, 2018 • retagged Jun 10, 2022 by makhdoom ghaya eyeamgj 333 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply Hemanth_13 commented Nov 17, 2018 reply Follow Share eyeamgj n%i condition fails only two times so you will get (n-2)log n base 10 time complexity will be O(nlogn) 0 votes 0 votes eyeamgj commented Nov 17, 2018 reply Follow Share YA BUT ACTUALLY WHAT I WROTE WITHOUT O IS CORRECT? 0 votes 0 votes Please log in or register to add a comment.