Write a program that will print the factorial of any number
Answers
Answered by
2
Answer:
Explanation:
#include <stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i, fact = 1, num;
printf("Enter the number \n");
scanf("%d", &num);
if (num <= 0)
fact = 1;
else
{
for (i = 1; i <= num; i++)
{
fact = fact * i;
}
}
printf("Factorial of %d = %d\n", num, fact);
getch();
}
Similar questions
Environmental Sciences,
6 months ago
Biology,
6 months ago
English,
1 year ago
History,
1 year ago
Math,
1 year ago