For the function to be continuous at \( x = \frac{\pi}{2} \), we need to ensure that the left-hand limit and the right-hand limit at \( x = \frac{\pi}{2} \) are equal.
From the left-hand side: \[ \lim_{x \to \frac{\pi}{2}^-} f(x) = m \left( \frac{\pi}{2} \right) + 1 \] From the right-hand side: \[ \lim_{x \to \frac{\pi}{2}^+} f(x) = \sin \left( \frac{\pi}{2} \right) + n = 1 + n \] Equating the two expressions for continuity: \[ m \left( \frac{\pi}{2} \right) + 1 = 1 + n \] \[ m \left( \frac{\pi}{2} \right) = n \] Thus, \( n = \frac{m\pi}{2} \).