Showing posts with label factorial program. Show all posts
Showing posts with label factorial program. Show all posts

Sunday, 8 September 2019

How to write a program to find the factorial of given numbers?

#include<stdio.h>
#include<conio.h>
void main()
{
  int I, n, f;
  clrscr(); 
  printf("Enter the number ");
  scanf("%d",&n);
   While(i<= n)
   {
      f= f*i;
      i++
   }
  printf(" The factorial if the number is=% d\n",n, f);
getch();
}





Wednesday, 31 July 2019

How to write a program to find the factorial of a given number?

#include<stdio.h>
#include<conio.h>
void main()
{
  int i, fact=1, num;
  printf("Enter the number/n");
  scanf("%d", &num);
    if(num=0)
           fact=1
    else
        {
            for(i=1;i<=num;i++)
     {
         fact*i
}
}
   printf("factorial of number%d=%5 d/n",num, fact);
getch();
}