C Program for Factorial of a Number

C Program for Factorial of a Number

posted in: C Programming | 1

C Program for Factorial….


How Factorial is Calculated?


Factorial is simply defined as “the product of an integer (n) and all the integers below it. For Example- Factorial three ( 3! ) is equal to 6

Factorial of a number ‘N’ is represented as N!

N! is calculated as N*(N-1)*(N-2)*(N-3)……*1

Let the Value of N is 5 then Factorial of N is 5*4*3*2*1=120


C Program for Factorial

C Program for Factorial of a Number:


#include <stdio.h>
#include <conio.h>
int main()
  int n, i;
  unsigned long long fact = 1;

  printf(“Enter a number to Find its Factorial: “);

  if (n < 0)
    printf(“Error! Factorial of a negative number doesn’t exist”);

    for(i=1; i<=n; i++)
        fact = fact * i;
  printf(“Factorial of %d = %llu”, n, fact);

  return 0;




Enter a number to Find its Factorial: 6

Factorial of 6 = 720

Technym is a Tech Blog for all those who want to get in depth of the Technology. We Provide Various Online Money Making Guides, tech tutorials, tips and tricks and Tech Updates. Our Main motive is just to spread informative Content and works under the philosophy of Keeping the Readers Informed.

Also Find C Program for factorial in other Programming languages as well

Please Bookmark this Page if you like to find more such Programming Codes in various Languages.

One Response

  1. Yogesh prajapati

    Nice post great work.. If you want to increase your traffic.
    How To Get Organic Traffic from Google, Bing, Yahoo, Yandex. Legal Ways

Leave a Reply