Basic Question

Hey Guys I am New to programing.I was Solving Small Factorial FCTRL2 . Can Anybody Tell Me whats wrong with my code or approch . I will apreciate your Help…
Thank You

#include<stdio.h>
main()
{ int i,j,z,fact=1 ;
scanf("%d",&i) ;
int num1[z],res[z] ;
for(j=0;j<i;j++)
{ scanf("%d",&num1[j]) ;
while(num1[j]>0)
{
fact*=num1[j] ;
num1[j]-- ;
}
res[j]=fact ;
fact=1 ;

}
for(j=0;j<i;j++)
{
printf("\n%d",res[j]) ;
}
}

Better if you give a link to your submission: https://www.codechef.com/viewsolution/19953631 . For more complicated problems you could then describe how your program is intended to solve the challenge - not needed so much for this one of course.

Here you have

scanf("%d",&i) ;

int num1[z],res[z] ;

where it seems you probably meant to direct input to z not i.

For this particular problem there is a tutorial which you might find is worth reading. Note that 100! is relatively big, with 158 digits.

//