hi guys, (yes i searched the internet and this forum for help but i dont need to have a user enter which number they want to calculate the factorial for. my program just needs to calculate the first 10 factorials.)
here's what i have so far. it compiles but gives an output of just 0.
any ideas where i went wrong?Code:#include <stdio.h>
main()
{
int fact = 1;
int i;
for ( i = 1; i <=10; ++i )
while(i>=1)
{
fact = fact*i;
i = i-1;
}
printf("\n%d\n", fact);
return 0;
}