More you share, more you have!!!

More you share, more you have!!!

C program for finding factorial of number

factorial of number


This program is about finding factorial of number. Given the number, this program will use logic of multiplying number with previous multiplier.

Source Code:

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,temp=1;
clrscr();
printf("\n Enter number\t");
scanf("%d",&i);
  for(j=i;j>=1;j--)
            {
               temp=temp*j;
            }
printf("\n Factorial of number %d is %d",i,temp);
getch();
}

Cross-check your answer with this ->

Enter number   5
Factorial of number 5 is 120

Share on Google Plus
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment