/ Undifined / 13 - WAP to find the factorial of a given number.

13 - WAP to find the factorial of a given number.

WAP to find the factorial of a given number.
#include<stdio.h>
int main(){
  int i=1,f=1,num;
 
  printf("Enter a number: ");
  scanf("%d",&num);
 
  while(i<=num){
      f=f*i;
      i++;
  }
 
  printf("Factorial of %d is: %d",num,f);
  return 0;
}
Output 
Enter a number: 5
Factorial of 5 is: 120

about author

Blogger Sens it website about blogger templates and blogger widgets you can find us on social media
Previous Post :Go to tne previous Post
Next Post:Go to tne Next Post

No comments:

Post a Comment