Step 1:
Given : $f(x)=\left \{\begin{array}{1 1}\large\frac{1-\cos kx}{x\sin x}, & if\;x\neq 0\\\large\frac{1}{2}, & if\;x=0\end{array}\right.\;at\;x=0$
Consider $f(x)=\large\frac{1-\cos kx}{x\sin x}$
This can be written as $\large\frac{2\sin^2\Large\frac{kx}{2}}{x\sin x}$
Multiply and divide by $\large\frac{k^2x}{2}$
$f(x)=\large\frac{\sin^2\big(\Large\frac{kx}{2}\big).\Large\frac{k^2x}{2}}{\big(\Large\frac{kx}{2}\big)^2.\large \sin x}$
$f(x)=\bigg(\large\frac{\sin\Large\frac{kx}{2}}{\Large\frac{kx}{2}}\bigg).\big(\large\frac{x}{\sin x}\big).\large\frac{k^2}{2}$
Step 2:
We know that $\lim\limits_{\large x\to 0}\bigg(\large\frac{\sin\theta}{\theta}\bigg)=$$1$
$\therefore$ $L.H.L.=R.H.L.=$
$\lim\limits_{\large x\to 0}\bigg(\large\frac{\sin\Large\frac{kx}{2}}{\Large\frac{kx}{2}}\bigg).\big(\large\frac{x}{\sin x}\big).\large\frac{k^2}{2}=\large\frac{k^2}{2}$
At $x=0$
$f(0)=\large\frac{1}{2}$
Given that $f(x)$ is continuous
$\therefore\:\large\frac{k^2}{2}=\frac{1}{2}$
$\Rightarrow k^2=1$
$k=\pm 1$