Факториал в цикле
/* */
/* Polozov Victor (с) 2009 */
/* Task 1b: iterative factorial */
/* */
#include "stdio.h"
int main()
{
int n;
int i;
int fact = 1;
/* read N */
scanf("%d", &n);
/* N! = 2 * 3 * ... N, if N >= 2 */
/* N! = 1 else */
for (i = 2; i <= n; i++)
{
fact = i * fact;
}
/* print N! */
printf("%d", fact);
return 0;
}
* This source code was highlighted with Source Code Highlighter.