Question:Factorial program in c using for loop 

Answer 
#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;
}
 

+ ExplanationNot Moderated
+ Report
Total Preview: 581
Factorial program in c using for loop
Copyright © 2024. Powered by Intellect Software Ltd