answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: What is an algorithm to compute factorial of n?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write algorithm compute sum of square of N numbers?

1. Design an algorithm to compute sum of the squares of n numbers?


What is factory or factorial?

Factorial for number N is N x N-1 x N-2 X N- (N-1). e.g. if you need to calculate factorial for 5 then compute 5 x 4 x 3 x 2 x 1.


An algorithm that generates all r-permutations of an n-element set?

P(n,r)=(n!)/(r!(n-r)!)This would give you the number of possible permutations.n factorial over r factorial times n minus r factorial


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<=n;++i) f*=i; return f; }


What is a factorial loop?

An example in Java, to compute 10!: int factorial = 1; for(int i = 1; i < 11; i++) { factorial *= i; }


How do algorithm to find the factorial of a number?

Factorial (n) = n * Factorial (n-1) for all positive values n given Factorial (1) = Factorial (0) = 1. Pseudo-code: Function: factorial, f Argument: positive number, n IF n<=1 THEN RETURN 1 ELSE RETURN n * f(n-1) END IF


Write a recursive procedure to compute the factorial of a number?

#include <iostream> using namespace std; int main() { int i, number=0, factorial=1; // User input must be an integer number between 1 and 10 while(number<1 number>10) { cout << "Enter integer number (1-10) = "; cin >> number; } // Calculate the factorial with a FOR loop for(i=1; i<=number; i++) { factorial = factorial*i; } // Output result cout << "Factorial = " << factorial << endl;


Algorithm for finding the factorial using iterative function?

// returns n! int fact(int n) { int f_n = 1; for(int i = n; i > 1; --i) { f_n *= n; } return f_n; }


Why is n factorial equal to n factorial x n?

It is not except when n = 1.


What is the value of factorial negative n?

what is the value of negative n factorial ?


What is recursive algorithm?

Algorithm can be defined as an interpretable, finite set of instructions for dealing with contigencies and accompanying task that has recognizable end-points for given inputs. It is a tool for solving a well computational problem. A recursive algorithm is one which calls itself.


C program to find factorial of a no?

this is a code for calculating it recursivelly: float Factorial (float n) { if (n<=1) return 1.0; else return n* Factorial(n-1); }