Friday, December 20, 2013

Simple factorial code in C


#include <stdio.h>

int main(void)
{
int input, count;

printf("Please enter a number: ");
scanf("%i", &input);

for ( count = input - 1; count != 1; --count )
{
input *= count;
}

printf("%i\n", input);
return 0;
}

No comments:

Post a Comment