Electron and proton are charged particle. A charged particle moving a magnetic field experiences a force that is perpendicular to both the particle velocity and to the magnetic field itself.
Lorentz force law : Magnitude of the magnetic force on a moving, charged particle is
F = qvB sin θ
where q = charge, B = magnetic field, v = velocity, θ = angle b/w the charges velocity and magnetic field.