I have tried below code , but it is showing not accurate answers
M = seq(10,20)
print(which(M > 13 & M<20))
Your code is correctly showing position of elements. See?
> print(which(M > 13 & M<20))
[1] 5 6 7 8 9 10 <-- position of elements
> M[which(M > 13 & M<20)]
[1] 14 15 16 17 18 19 <-- actual values