Starting Vocational Training From 1-May-2024 Get Detail


Write a C program to calculate the factorial of a given number. 
Test Data :
Input the number : 5 
Expected Output : 
The Factorial of 5 is: 120 


???????


#include <stdio.h>
void main(){
  int i,f=1,num;

  printf("Input the number : ");
  scanf("%d",&num);

  for(i=1;i<=num;i++)
      f=f*i;

  printf("The Factorial of %d is: %d ",num,f);
}