Pages

Write a program to calculate factorial of given number in c language.

Tuesday, 16 July 2013

#include <stdio.h>
#include <conio.h>

int main()
{
   int num, i, sum=1;
   printf("Enter a number: ");
   scanf("%d", &num);
   for(i=1; i<=num; i++)
   {
         sum=sum*i;
   }
   printf("Factorial of %d is %d.", num, sum);
   getch();
}

 

Search Box

Most Reading

Contact Form

Name

Email *

Message *