0% found this document useful (0 votes)
39 views1 page

Flowchart for Recursive Factorial Calculation

The document outlines a flowchart for calculating the factorial of a number. It includes steps for inputting a number, checking if it is negative, and either printing an error message or calling a recursive factorial function. The process concludes with displaying the factorial result and stopping the program.

Uploaded by

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

Flowchart for Recursive Factorial Calculation

The document outlines a flowchart for calculating the factorial of a number. It includes steps for inputting a number, checking if it is negative, and either printing an error message or calling a recursive factorial function. The process concludes with displaying the factorial result and stopping the program.

Uploaded by

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

digraph {

size="8,8"
A [label=Start shape=oval]
B [label="Enter a number" shape=parallelogram]
C [label="num < 0?" shape=diamond]
D [label="Print \"Factorial is not defined
for negative numbers.\"" shape=parallelogram]
E [label="Call factorial(num)" shape=rectangle]
F [label="Print factorial result" shape=parallelogram]
G [label=Stop shape=oval]
H [label="factorial(n)
if n == 0 or n == 1: return 1
else: return n * factorial(n-1)" shape=rectangle]
A -> B
B -> C
C -> D [label=Yes]
D -> G
C -> E [label=No]
E -> H
H -> F
F -> G
}

You might also like