Let B and W represent the number of black and white keys, respectively.
Since the ratio of black keys to white keys is 5 to 7, then:

Additionally, since there is a total of 240 keys, then:

Isolate W from the first equation and substitute the value in the second equation to be able to solve for B:


Therefore, there are 100 black keys.