This is a code about entering the no. of test cases and finding the factorial of each case.....but the codechef is not accepting this answer, can anybody please tell me whats wrong in this code...please plaese help me...i m a beginner
include<stdio.h>
include<stdlib.h>
long int fact(long int m) {long int f=1; for(int j=m;j>=1;j--) { f=f*j; } return f; } int main() { long int n,m,f; scanf("%ld",&n); if(n>100) { printf("not valid"); exit(0); } for(int i=1;i<=n;i++) { scanf("%ld",&m); if(m>100) { printf("invalid number"); exit(0); } f=fact(m); printf("%ld",f); } return 0; }