Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

small factorials

$
0
0
/* my code fore the program small factorial */
/*move to bottom*/

#include<stdio.h>
double FACT(short int n) ;
int main()
{
short int X,i=0;
int NUM[100];
scanf("%d",&X);
if(1<=X<=100){
while(i<X){
scanf("%d",&NUM[i]);
i++;
}
}
i=0;
while(i<X){
        if(1<=(NUM[i])<=100){
printf("%.0lf\n",FACT(NUM[i]));
}
i++;
}
return 0;
}

double FACT(short int n){
short int i;
double sum=1;
for(i=1;i<=n;i++){
sum*=i;
}
return(sum);
}


/*When i tried to submit it, Compiler says Wrong Answer. Can u figure out the problem.......please....*/

Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>