I am beginner in C and I was experimenting with
printf("\nInside the loop :");
printf("\nInside the loop\n");
The reason is that your loop conditions (between two semicolons) look like this:
i++ <=5, printf("\nCondition") // First loop printf("\nCondition"), i++<= 5 // Second loop
Both conditions are comma expressions, meaning that only the last part matters in terms of generating the value (both parts are good for their side effects, though).
In the first case, the overall condition result is what
printf("\nCondition") returns. It always returns non-zero*, interpreted as "true", so the loop is infinite.
In the second case, the overall result is what
i++<=5 returns, which starts off as "true", and becomes "false" after five iterations. That is when the second loop terminates.
printf returns the number of characters printed, so in your case that would be 10. This is not essential to understanding why the loop is infinite, though.