1//Factorial of a given number
2#include <stdio.h>
3
4//This function returns factorial of the number passed to it
5long int factorialOf(int number){
6 long int factorial = 1;
7 while(number){
8 factorial*=number;
9 number-=1;
10 }
11 return factorial;
12}
13
14int main(void) {
15 int n;
16 printf("Find factorial of \n");
17 scanf("%d",&n);
18 printf("\nThe factorial of %d is %ld",n,factorialOf(n));
19 return 0;
20}
1#include<stdio.h>
2int main()
3{
4int i,fact=1,number;
5printf("Enter a number: ");
6scanf("%d",&number);
7for(i=1;i<=number;i++){
8fact=fact*i;