Question: Write a program to place ten queens on 10 x 10 chessboard in such a way that one queen is to be in each

Write a program to place ten queens on 10 x 10 chessboard

Write a program to place ten queens on 10 x 10 chessboard in such a way that one queen is to be in each row. A program will use 2 DIMENIONAL array x[r][c] to do this configuration. If x[r] has value c, then in row r there is a queen in column c. Write a program that asks a user to enter the columns that contain queens in the ten rows. The program then places the queens in these columns (one per row) and prints the board. For example, if the user enters: 1,0,7,7,0,3,2,6,8,4 this means in the first row, the queen will be placed in the second column, in the second row, the queen will be placed on the first column, in the third row, the queen will be placed on the eighth column and so on. So, based on the above user input, the output will be Q

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 Programming Questions!