Computer Science, asked by SumitBattan5310, 1 year ago

Write the program of factorial in c

Answers

Answered by princessgagan2pdcgcl
1

#include <stdio.h>

#include <conio.h>

int main()

{

  int c, n, fact = 1;

printf("Enter a number to calculate its factorial\n");

scanf("%d", &n);

for (c = 1; c <= n; c++)

fact = fact * c;

printf("Factorial of %d = %d\n", n,fact);

return 0;

}

Answered by k799
0

Answer:

#include<iostream>

int main{

int num, fact=1;

std::cout<<"Enter a number: ";

std::cin>>num;

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

fact = fact*i;

std::cout<<"Factorial of "<<num<<" is "fact;

}

Explanation:

Similar questions