+ 9
Why not after 23?
In my compiler it doesn't work when I input 23 and the higher value. #include<stdio.h> int main() { int t,n,i; double f; scanf("%d",&t); while(t>0) { f=1; scanf("%d",&n); for(i=1;i<=n;i++) { f=f*i; } printf("%.0lf\n",f); t--; } } Can you have that kind of experience before. What should I do?
3 Answers
+ 3
Why not you just use the second one!!
Actually I don't know the cause đ
+ 6
#include<stdio.h>
int main()
{int t,n,temp,j,m,a[200],i,x;
scanf("%d",&t);
while(t--)
{m=1,a[0]=1,temp=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=0;j<m;j++)
{x=a[j]*i+temp;
a[j]=x%10;
temp=x/10;
}
while(temp>0)
{
a[m++]=temp%10;
temp=temp/10;
}
}
for(i=m-1;i>=0;i--)
{
printf("%d",a[i]);
}
printf("\n");
}
return(0);
}
This code works. But why not that?
+ 2
Can you upload the code to Code Playground and explain exactly what your input is and what doesn't work?