Practice mode [EASY] Nuclear reactor problem

#include<stdio.h>
void main()
{
int n,c;
long long int k;
scanf("%lld %d %d",&k,&n,&c);
printf("\n");
int p[c];
long long int i,j;
for (i=0;i<c;i++) p[i]=0;
for (i=0;i<k;i++)
{
j=0;
p[j]++;
do
{
if (p[j]>n)
{
p[j]=0;
if (j!=c-1)
{j++;
p[j]++;}
}
else break;
}while(j<c);
}
for (i=0;i<c;i++) printf("%d ",p[i]);
}

its showing runtime error …donno why…
PLZ HELP!!

do
{
if (p[j]>n)
{
p[j]=0;
if (j!=c-1)
{j++;
p[j]++;}
}
else break;
}while(j<c);

go through this loop for j=c-1&&p[c-1]>n;
j wont increment and loop is infinite loop

there is a small problem,you are not returning 0 at end of the program.small modification in your code gives no runtime.here is the link http://ideone.com/gf3uUk where your code is modified and gives successful output.use int main(){…return 0;} instead of void main(){}.