small factorial

I used the tutorial method for small factorial and every test case I’ve tried matches the calculator answer but codechef is still giving me ‘Wrong Answer’. Can someone please tell me what to fix? Is it the format of the output that’s wrong?

My code: CodeChef: Practical coding for everyone

Terima kasih dan salam kenal.
codechef Link

code Link

Terima kasih dan salam kenal.
codechef Link

code Link

Whats wrong in this code?

#include<stdio.h>

int main()
{
int i,j,t,fact=1;
int a[200];

printf(“enter the test cases\n”);
scanf("%d",&t);

printf(“enter all numbers\n”);

for(i=0;i<t;i++)
{
scanf("%d",&a[i]);
for(j=1;j<=a[i];j++)
{
fact=fact*j;
}
printf("\nfact for %d is: %d",a[i],fact);
fact=1;
}

return 0;
}

There is very minor error in your code , your logic is alright .

you forgot to insert the newline character after printing 1 .

intead of printf ("%d",1);

use

printf ("%d\n",1);