continue keyword is used to send the control back to the loop without executing remaing code.
now comes to ur problem:-
when u enter any -ve number then only continue statement get execute.
in ur program increment of variable i is also play a important role how:-
in ur first program i value get incremented as contol come back to the loop that's why u get answer 13
but in second program the value of i will incremented only when if condition get false.

try one more thing enter all number -ve u find that every time u get a message on console
Enter the value:-
the reason is i value doesn't change.