Factorial using function.
Factorial using function in c language.
Factorial of any number is product of that number and all the number below it.This blog will print factorial of number using return type function in c language.
This program has run on turbo editor.So you can use this code without any hesitation.
#include<stdio.h>
#include<conio.h>
int fact(int);
void main()
{
clrscr();
int num,k;
printf("Enter number\n");
scanf("%d",&num);
k=fact(num);
printf("Factorial of number is %d",multi);
getch();
}
int fact(int X)
{
int i,multi=1;
for(i=1;i<=X;i++)
{
multi=multi*i;
}
return multi;
}
Factorial using function.
Reviewed by Deepak kumar soni
on
December 29, 2018
Rating:
No comments: