A good answer might be:

Yes. It is nice to check these cases out in advance before you start writing the program.


Starting the Program

Here is a start to the program.

import java.io.*;

// User enters integer N.  The program calculates N factorial.
//
class factorial
{
  public static void main (String[] args ) throws IOException
  {
    BufferedReader userin = new BufferedReader 
        (new InputStreamReader(System.in));
    String inputData;
    long    N, fact = 1; 

    System.out.println( "Enter N:" );
    inputData = userin.readLine();
    N         = Integer.parseInt( inputData );

    if (_________________ )
    {
      while ( _________________  )    
      {
 
        _________________

        _________________
      }
      
      System.out.println( "factorial is " + fact );
    }
    
    else
    {
      System.out.println("N must be zero or greater");
    }
  }
}

Notice how the program matches the flowchart. Examine carefully how the while statement is part of the false branch of the if statement. The indenting (and the braces {} show this structure.)

QUESTION 8:

Fill in the four blanks to complete the program.