--- In [email protected], "ruhatadiyaman" <ruhatadiya...@...> wrote:
>
> thanks for all replies. i tried them but still the problem
> is continuing. this is my code with 'unsigned long int';
If you just use double for your fak variable, you end up with this, which works
for me (gcc):
#include<stdio.h>
int main(void) {
int x, y;
double fak;
for (x = 1; x <= 20; x++) {
printf("%d!\t", x);
fak = x;
if (x >= 2) {
for (y = x; y >= 2; y--) {
fak *= y - 1;
}
}
printf("%.0f\n", fak);
}
return 0;
}
1! 1
2! 2
3! 6
4! 24
5! 120
6! 720
7! 5040
8! 40320
9! 362880
10! 3628800
11! 39916800
12! 479001600
13! 6227020800
14! 87178291200
15! 1307674368000
16! 20922789888000
17! 355687428096000
18! 6402373705728000
19! 121645100408832000
20! 2432902008176640000