Factorial Using CALL BY Refrance

//Fact Using call by Refrance.

#include<stdio.h>
main()
{
 int n,f;
 int fact(int*);
 printf("enter value");
 scanf("%d%d",&n,&f);
 f=fact(&n);
 printf("factorial=%d\n");
}
int fact(int *x)
{
 int n,i,fact;
 for(i=1;i<=n;i++)
 fact=fact*i;
 return(fact);
}

No comments:

Post a Comment