Factorial in c language.
Factorial in c language
Factorial is product of integer and all the integer below it.
This blog will introduce you to the concept of finding the factorial of any number.
Example of factorial
5!=5*4*3*2*1=120
6!=6*5*4*3*2*1=720
2!=2*1=2
Following methods has used in program
- Take number from user to find the factorial of number.
- Take another number and initialize it by one.
- Run the iteration form one to input number.
- Apply the statement to find factorial of number.
- And finally print the factorial of number.
Factorial in c language.
This program has run in turbo editor.
#include<stdio.h>
#include<conio.h>
{
clrscr();
int num, multi=1,i;
printf("Enter number\n");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
multi=multi*i;
}
printf("Factorial of number is %d",multi);
getch();
}
Factorial in c language.
Reviewed by Deepak kumar soni
on
December 29, 2018
Rating:
No comments: