In this line, you have i = 0. What do you think that is doing? I would suggest looking up the difference between the assignment operator and comparison operators. There is a further issue with the logic there, but if you fix this here, it works.
The starting condition in yours is i = num. So you’re saying "set my i to the value of num before looping. Works as intended, and will do exactly as you say.
The continuing condition means “Loop so long as this condition is being met.” In your case, you’re saying “Loop as long as i is exactly equal to 0.” But is that your intent?