hi, i have a simple problem with my factorial program.
I can't seem to get my .exe to stay open or when i do i can't input my numbers correctly. Any help with this?
I know this is not the easiest way to do factorial but just ignore that. Also im new to C programming, so thanks for your patience and help.
void factorial (long number, long *result);
int main (int argc, char *argv)
long argument, result;
if (argc != 2)
sscanf(argv, "%ld", &argument);
printf("%1d! = %1d\n", argument, result);
void factorial (long number, long *result)
if (number < 2)
*result = 1;
factorial (number - 1, result);
*result = number * (*result);