answersLogoWhite

0

What is the pseudocode of fatorial notation?

Updated: 8/17/2019
User Avatar

Wiki User

14y ago

Best Answer

First, the answer to what is factorial. Factorial is denoted by '!' N! = N * (N-1) * (N-2) * ... * 3 * 2 * 1. For example, 5! = 5 * 4 * 3 * 2 * 1 = 120.

There are two approaches to coding a function that will calculate n!. One does it iteratively, and the other recursively.

Iteratively:

factorial (n){

result <- 1

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

result <- result * i

}

return result

}

Recursively:

factorial (n){

if n is 1 return 1

return n * factorial(n - 1)

}

Note that n must be 1 or greater for each of the above methods.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the pseudocode of fatorial notation?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Fatorial of a number program in javascript?

hi darling


What is the fatorial of 5?

5! = 5*4*3*2*1 = 120


Types of algorithm?

pseudocode


What is imitation code?

pseudocode


What is a pseudocode design tool?

SPOK (Structured Prose Organizer for KEDIT) is a pseudocode design tool. (SPOK4 at Verizon.Net)


Difference between pseudocode and structured English?

structured English resembles spoken Englishwhere as pseudocode resembles programming languageWhat_are_the_differences_between_structured_English_and_pseudo_code


Develop an algorithm to display all prime numbers from 2 to 100 Give both the pseudocode version and the flowchart version Convert your pseudocode into a Java program?

Develop an algorithm to display all prime numbers from 2 to 100. Give both the pseudocode version and the flowchart version. Convert your pseudocode into a Java program.


What is the difference between pseudocode and trace table?

pseudocode is a sentence-like representation of a piece of code while a trace table is a technique used to test a algorithms.


Which piece of pseudocode represents incrementing the loop control called rep?

There is no standard for pseudocode. Pseudocode is generally expected to be intuitively understood by its target audience, but it doesn't need similarity with natural language or familiar programming language. Therefore, all the following are pseudocode examples to increment a variable called rep: rep = rep + 1 add 1 to rep increment rep ++rep next rep


Is a text based approach to documenting an algorithm?

pseudocode


What are the importance of pseudocode?

enables the programmer to concentrate on algorithms.


What is a text based approach to documenting an algorithm?

pseudocode