Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

factorial c program using for loop

#include<stdio.h>
int main(){
  int i,f=1,num;
 
  printf("Enter a number: ");
  scanf("%d",&num);
 
  for(i=1;i<=num;i++)
      f=f*i;
 
  printf("Factorial of %d is: %d",num,f);
  return 0;
}
Source by www.javatpoint.com #
 
PREVIOUS NEXT
Tagged: #factorial #program #loop
ADD COMMENT
Topic
Name
7+3 =