English, asked by vijaSagnikhanasubr, 1 year ago

C program for factorial of a number?

Answers

Answered by sanish
5
Here is your program to find factorial of a number.

#include<stdio.h>
#include<conio.h>
void main( )
{
int i, n, fact;
clrscr( );
printf("Enter the value of n");
scanf("%d", &n);
fact=1;
for(i=n ; i >=1; i--)
fact=fact*i;
printf("The factorial of %d is %d",n, fact);
getch( );
}
Answered by samarthkrv
0

Answer:

#include <stdio.h>

int main()

{

   int fact = 1;

   int num;

   printf("Enter the number:");

   scanf("%i" , &num);

       for(int i = 0; i < num; i++)

           {

               fact = fact * (i+1);

           }

   printf("The factorial is %i " , fact);

   return 0;

}

Explanation:

Similar questions