In Class Ex -- While Loop

  1. Write programs using looping to print three patterns:
    (1) A square of zeros of any size;
    Enter the size of the square:
    16
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    Press any key to continue . . .
    
    (2) A square of zeros of any size with 1's on the first diagonal;
    Enter the size of the square:
    20
    1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
    Press any key to continue . . .
    
    (3) A square of zeros of any size with 1's on the second diagonal;
    Enter the size of the square:
    18
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    Press any key to continue . . .
    
    (4) A square of zeros of any size with 1's on both diagonals;
    Enter the size of the square:
    20
    1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
    0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
    0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
    0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
    0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
    0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0
    0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0
    0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0
    0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0
    0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0
    0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
    0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
    0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
    0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
    1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
    Press any key to continue . . .
    
    (5) A flag.
    15
    * * * * * * * - - - - - - - -
    * * * * * * * - - - - - - - -
    * * * * * * * - - - - - - - -
    * * * * * * * - - - - - - - -
    * * * * * * * - - - - - - - -
    * * * * * * * - - - - - - - -
    * * * * * * * - - - - - - - -
    - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - -
    Press any key to continue . . .
    
    
    26
    * * * * * * * * * * * * * - - - - - - - - - - - - -
    * * * * * * * * * * * * * - - - - - - - - - - - - -
    * * * * * * * * * * * * * - - - - - - - - - - - - -
    * * * * * * * * * * * * * - - - - - - - - - - - - -
    * * * * * * * * * * * * * - - - - - - - - - - - - -
    * * * * * * * * * * * * * - - - - - - - - - - - - -
    * * * * * * * * * * * * * - - - - - - - - - - - - -
    * * * * * * * * * * * * * - - - - - - - - - - - - -
    * * * * * * * * * * * * * - - - - - - - - - - - - -
    * * * * * * * * * * * * * - - - - - - - - - - - - -
    * * * * * * * * * * * * * - - - - - - - - - - - - -
    * * * * * * * * * * * * * - - - - - - - - - - - - -
    * * * * * * * * * * * * * - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Press any key to continue . . .
    
  2. Write programs using looping to find out the largest integer from a data file containing integers: 5 2 3 4 10 6
  3. Turn in the printouts of your programs and output.