Not getting desired result. Losing the first element of the list

Here is the code of my circular linked list implementation. I am losing the first element always while inserting them.
I am unable to find where I am doing this wrong.
Expected Output: 15 -> 10 -> 5 -> 20-> 25 ->
My Output: 15 -> 10 -> 5 -> 20->

Because of while loop condition it is not printing last one.

we should use do while loop
do{
logic
temp=temp->next;
} while(temp!=head);
If this resolves your query then please mark it as resolved :slight_smile:

Yes thanks, it is resolved.