why this is showing wrong answer

#include<stdio.h>

int fact(int num)
{
	int r;
if(num==1)
return 1;
return(num*fact(num-1));
}

main(){

int n,a[200],i;
scanf("%d",&n);
if(n>0 && n<=100){
for(i=1;i<=n;i++){
	scanf("%d",&a[i]);


}
	i=1;
		while(i<=n){
	printf(	"%d \n",fact(a[i]));

i++;
}
}
}

Search forum. This question is already answered many times. And also add question link in future.