I wrote this program in C for prime factors but its crashing after printing first prime factor, So i need help 

```
#include<stdio.h>
void prime(int n,int i)
{
    i=2;
    if(n%i==0)
    {
        printf("%d ",i);
        n=n/i;
        prime(n,i);
    }
    else
    {
        i++;
        prime(n,i);
    }
}
void main()
{
    int n;
    scanf("%d",&n);
    prime(n,2);
}

```