answersLogoWhite

0

C program to find factorial of a no?

Updated: 8/17/2019
User Avatar

Wiki User

14y ago

Best Answer

this is a code for calculating it recursivelly:

float Factorial (float n)

{

if (n<=1) return 1.0;

else return n* Factorial(n-1);

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program to find factorial of a no?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a c program to find the factorial of 125?

int main (void) { puts ("18826771768889260997437677024916008575954036487149242588759823150835\ 31563316135988668829328894959231336464054459300577406301619193413805\ 97818883457558547055524326375565007131770880000000000000000000000000\ 000000"); return 0; }


Program to find the factorial of a number using recursion?

/*program to find the factorial of a given number*/ #include&lt;stdio.h&gt; #include&lt;conio.h&gt; int fact(int); void main() { int n,c; printf("\n enter the number for which you want to find the factorial"); scanf("%d",&amp;n); c=fact(n); printf("\n the factorial of the number %d is %d",n,fact); getch(); } int fact(int n) { int k; if(n==0) return(1); else k=n*fact(n-1); return(k); }


Mini project in c language with coding?

C Program to find factorial of a numberSimple C Programint main() {int n,i,f=1;printf("enter any num \n");scanf("%d",&n);for(i=1;i


What is the logic and theory for pascal triangle program in C?

long factorial(int); int main() { int i, n, c; printf("Enter the number of rows you wish to see in pascal triangle\n"); scanf("%d",&n); for ( i = 0 ; i < n ; i++ ) { for ( c = 0 ; c


7 Write a C program to compute the factorial of a number using for loop?

int factorial(int n) { int i; int f=1; for(i=2;i&lt;=n;++i) f*=i; return f; }


Write a C-like program fragment that calculate the factorial function for argment 12 with do while loop?

#!/usr/bin/perl print factorial($ARGV[11]); sub factorial { my($num) = @_; if($num == 1) { return 1; # stop at 1, factorial doesn't multiply times zero } else { return $num * factorial($num - 1); # call factorial function recursively } }


What is a program in c to calculate factorial of number?

First of all we will define what factorial is and how to it is calculated.Factional is non negative integer. Notation would be n! It is calculated by multiplying all integers from 1 to n;For example:5! = 1 x 2 x 3 x 4 x 5 = 120.Note: 0! = 1Small C program that illustrates how factorial might be counted:#include int factorial(int num);int main() {int num;printf("Enter number: ");scanf("%d", &num);printf("Factorial: %d\n", factorial(num));return 0;}int factorial(int num) {if (num == 0) {return 1;}return num * factorial(num - 1);}Testing:Enter number: 5Factorial: 120Enter number: 0Factorial: 1


Program for sin series in c language?

find the program in c-pgms.blogspot.com


C program to find euler's number e?

#include &lt;stdio.h&gt; long factorial(int n) { long result = 1; for (int i = 1; i &lt;= n; ++i) result *= i; return result; } int main () { double n=0; int i; for (i=0; i&lt;=32; i++) { n=(1.0/factorial(i))+n; } printf("%.32f\n", n); } //2.71828182845904553488480814849027


What is the value of abc if abc equals a factorial plus b factorial plus c factorial?

145 1! = 1 4! = 24 5! = 120


How do you find factorial 5 in C programming?

to find the factorial we declare a variable n and initialize its value to 1 initiate a loop for example a for loop and multiply the numbers upto 5 code:- for(i=1,n=1;i&lt;=5;i++) { n=n*i; }


Program for calculating factorial no using recursion in c?

factorial n is given by formula n! = n.(n-1)....1 int i; long x; x =1; for (i=n;i&gt;1;i--) x = x*i ; will calculate factorial. I have put x as long to avoid integer overflow. checks for n is positive etc. to be added.