Linked list taking in put

on giving the input 1
2
4
5
6
8
-1
my output is 4–>2–>1–>2–>4–>5–>6–>8–>
4–>2 is getting printed extra

https://ide.codingblocks.com/s/285292 here is my code

hello @jatinupadhyay786

it working fine.

remove all other extra code from main that is not related to reading input.