thanks for all replies. i tried them but still the problem is continuing. this
is my code with 'unsigned long int';
/*factorial*/
#include<stdio.h>
int main()
{
int x, y;
unsigned long int fak;
for(x=1;x<=20;x++){
printf("%d!\t", x);
fak=x;
if(x>=2){
for(y=x;y>=2;y--){
fak=fak*(y-1);
}
}
printf("%lu\n", fak);
}
getch();
return 0;
}
so after 13 the results are wrong :(
otherwise i confused with usage of long double. i wrote this simple code which
is below;
#include<stdio.h>
int main()
{
long double x, y;
scanf("%Lf", &x);
scanf("%Lf", &y);
printf("x=%Lf y=%Lf\n", x, y);
printf("result=%Lf", x*y);
getch();
}
when i run it,for example, i give 2 for x and 4 for y,the program gives this;
x=2.000000 y=0.000000
result=-2.000000
what's this?
best regards