And if they both are same then why they are used differently? Pls give detailed answer
They are both the same law.
The parallelogram rule asks that you put the tails (end without the arrow) of the two vectors at the same point, (just the a vector and b vector on the left of the diagram) then it asks you to close the parallelogram by drawing the same two vectors again (the b vector and a vector to the right of the diagram).
If we take, in the diagram, the two vectors above the green line we see that this is just the triangle rule for $a+b$ and similarly the vectors below the green line are equal to $b+a$. The parallelogram rule is just the Triangle rule used twice at the same time, and really a demonstration that $A + B = B + A$
The head to tail rule asks that you take the tail of the second vector and place it at the head of the first vector. The head to tail rule applied to two vectors is simply the triangle rule.
If you have more than two vectors you keep adding the tail of the third vector to the head of the second, and the tail of the fourth to the head of the third and so on. When all vectors are accounted for the total vector goes from the tail of the first vector to the head of the last:
Where the vector A is the sum of P, Q, R, S and T.
triangular law and parallolgram law of vectors are the same for the fact that both laws are meant to determine resolve vectors into single vector (that is resultant of vector).