Gyan Mantra
Showing posts with label
factorial
.
Show all posts
Showing posts with label
factorial
.
Show all posts
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;
}
Older Posts
Home
Subscribe to:
Posts (Atom)