Question: Define an ocaml function, called print_checkerboard, that takes two inputs: num_rows and num_cols. It should print out a checkerboard pattern of Xs and underscores, separated

Define an ocaml function, called print_checkerboard, that takes two inputs: num_rows and num_cols. It should print out a checkerboard pattern of Xs and underscores, separated by spaces, having num_rows and num_cols, as illustrated below.

# print_checkerboard "X" "_" 4 3;; X _ X _ X _ X _ X _ X _ - : unit = ()

# print_checkerboard "X" "O" 3 4;; X O X O O X O X X O X O

- : unit = ()

Hint: Use print_alternating to print a single row, then make an appropriate recursive function call.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!