A sentinel controlled loop.
A well-organized program divides the different tasks into different modules.
Often, the main()
method is responsible for user interaction and other I/O.
main()
calls methods that perform various computations and report back to main()
.
The flowchart shows this style of organization.
The main loop is concerned with repeatedly asking the user for N
and calling a static method
that calculates N!
The box for calculating factorial shows that it is a method.
What is the parameter of the method that calculates factorial?
What is the return value of the method that calculates factorial?