I want to make a DC motor turn on while an LED is on but make it turn off when a Second LED is on with the click of a button

The Flow Chart of Fig-1 has described the solution to the problem of turing On/Off the Motor when the Button is pressed. Convert it into programming codes and execute on Arduino UNO.


Figure-1: