First node i.e., 10 is not printed in the output

you have given the input :-10,20,30,40,50
expected output:- 50 40 30 20 10
but your output is 50 40 30 20 why it is not printed 10 i.e last node?

Hello @priya_Jain
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);