Write a Pseudocode function that returns the factorial of an integer input.

--------------------------------------INPUT XY = 1
WHILE ( X > 1) Y = X * Y X = X - 1
OUTPUT Y-------------------------------It is also possible to complete this task using recursion
DEF fact(n):  IF (n > 1):    RETURN (n*fact(n-1))  ELSE    RETURN 1

Related Computing A Level answers

All answers ▸

Explain how a stack could be used in the process of evaluating an expression in Reverse Polish notation.


What are the main differences between different loops when it comes to coding ?


What is the time complexity of Bubble Sort?


Outline the differences between how a compiler and an interpreter works, and explain the advantages and usage of of each [12 marks]