ວຽກ​ບ້ານ​ພາ​ສາ C ຄິດ​ໄລ່​ Factorial

#include <stdio.h>
#include <conio.h>
main()
{
int a, b, factorial;
printf(“Enter number: “);
scanf(“%d”,&a);
if (a==0)
{
factorial=1;
}
else if (a<0)
{
printf(“Can not calculate”);
}
else
{
for (b=1;b<=a;b++)
{
factorial *= b;
}
}
printf(“%d”,factorial);
getch();
return 0;
}