Program to find out Factorial of given number

//Program to find out Factorial of given number
#include<stdio.h>
#include<conio.h>
int main()
{
  int n,j,k;
  clrscr();
  printf("Enter a number whose factorial you want to calculate\n");
  scanf("%d",&n);
  k=n;
  for(j=1;j<k;j++)
  {
     n=j*n;

  }
  printf("Factrorial of the %d is = %d",k,n);
  getch();
  return 0;
}


To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.

1 comment: