0% found this document useful (0 votes)
7 views2 pages

Factorial Calculation in C Programming

Uploaded by

jeevanchalise17
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Factorial Calculation in C Programming

Uploaded by

jeevanchalise17
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Function – Arguments and return value

#include<stdio.h>

int fact(int);

int main()

int m,n;

printf("Enter your no");

scanf("%d",&n) ;

m=fact(n);

printf("Factorial value is %d",m);

return 0;

int fact(int n)

int f=1,i;

for(i=1;i<=n;i++)

f=f*i;

return f;

}
Recursion function

#include<stdio.h>

int main()

int a,m;

printf("Enter your no");

scanf("%d",&a);

m=fact(a);

printf("Factorial value is %d",m);

return 0;

int fact(int n)

if (n==1)

return 1;

else

return n* fact(n-1);

==============================

You might also like