Nuclear Reactors problem got RTE

hi i dont know why but i get RTE on my program. Here my code

#include<stdio.h>

int a[101];
int main()
{
    int dig,bas,len;
    scanf("%d%d%d",&dig,&bas,&len);
    bas++;
    int tem(0);
    while(dig)
    {
            a[tem]=dig%bas;
            dig/=bas;
            tem++;
        //    printf("%d",dig);
    }
    for(int x=0;x<len;x++)printf("%d ",a[x]);
    printf("\n");
}

here my link for solution

this is your corrected code…

#include<stdio.h>

//int a[101];
int main()
{
    int dig,bas,len;
    scanf("%d%d%d",&dig,&bas,&len);
    bas++;
    int tem=0;
    while(tem<len)
    {
            //a[tem]=dig%bas;
            printf("%d ",dig%bas);
            dig/=bas;
            tem++;
            
    }
    //for(int x=0;x<len;x++)printf("%d ",a[x]);
   // printf("\n");
}

hope u get the mistake u were making…:slight_smile: