Evo koda koji sam napisao:
#include <stdio.h>
int Factorial(int broj);
int main(void)
{
int broj;
printf("Unesite pozitivan celi broj: ");
scanf("%d",&broj);
printf("Njegova faktorijal vrednost je: %d \n", Factorial(broj));
system("pause");
}
int Factorial ( int broj)
{
int brojac = 2;
long int faktorijal = 1;
while (brojac <= broj)
{
faktorijal = faktorijal * brojac;
brojac = brojac + 1;
}
return faktorijal;
}