Skip to content
← Back to Community
3.C. If/else: Rook move
Profile icon
MohamadAlshabab

Chess rook moves horizontally or vertically. Given two different squares of the chessboard, determine whether a rook can go from the first square to the second one in a single move.

The program receives four numbers from 1 to 8 each specifying the column and the row number, first two - for the first square, and the last two - for the second square. The program should output YES if a rook can go from the first square to the second one in a single move or NO otherwise.

Voters
Profile icon
kiankhooban
Profile icon
MohamadAlshabab