Showing posts with label factorial. Show all posts
Showing posts with label factorial. Show all posts

Tuesday, 7 June 2016

C program to find factorial by using pointers and recursion

#include<stdio.h>
#include<conio.h>
int fact(int);
main()
{
int n;
printf("enter value of fact to be find; \n");
scanf("%d",&n);
fact(n);
printf("%d factorial is %d",n,fact(n));
}
int fact(int m)
{
int f;
if(m==1)
return(1);
else
f=m*fact(m-1);
return(f);
}