Write a C program to find the factorial of the inputted number

Factorial definition- Factorial is the product of all positive integers less than or equal to n.
It is denoted by –  n! .
Write a C program to find the factorial of the number which is being inputted by the user. Below is the solution of the program –

/* Write a C program to find the factorial of that number*/
#include<stdio.h>
void main()
{
     int n,i,fact=1;

     printf("Enter any number\n");
     scanf("%d",&n);

     for(i=n;i>=1;i--)
     {
                      fact=fact*i;
     }
     printf("\n factorial = \t %d",fact);
     getch();
     }

Input – Enter any number to find the factorial of that number – 5

Output – Factorial of that number is – 120

yashan has written 70 articles

7 thoughts on “Write a C program to find the factorial of the inputted number

  1. Cecile says:

    Howdy! I could have sworn I’ve been to this site before but after going through some of the articles I realized it’s new to me.

    Regardless, I’m certainly happy I stumbled upon it and I’ll
    be bookmarking it and checking back frequently!

  2. Torsten says:

    I loved as much as you will receive carried out right
    here. The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get got an nervousness over that you wish be delivering the following.

    unwell unquestionably come more formerly again since exactly the
    same nearly very often inside case you shield this hike.

  3. GeoffreyDenh says:

    Hi admin, i see your page needs fresh content. Daily updates will rank your site in google higher,
    content is king nowadays. If you are to lazy to write unique posts everyday you should search in google for:

    Ightsero’s Essential Tool

  4. Jina says:

    Hey very nice blog!! Man .. Beautiful .. Amazing .. I will bookmark your site and take the feeds also?
    I’m satisfied to search out a lot of helpful information here within the
    submit, we want develop more strategies on this regard, thanks for sharing.
    . . . . .

Cancel reply

Leave a Reply to Torsten

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>