\documentclass{article}
\usepackage[left=3cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{listings}
\lstset{basicstyle=\ttfamily\footnotesize,breaklines=true,numbers=left,mathescape}
\begin{document}
\begin{lstlisting}
clear all;
clc;
j=1;
if j~=1
fprintf('j not equal to 1\n');
end
\end{lstlisting}
\end{document}
Why the tilde symbol in if j~=1 on the top? How to make it in the center on the line text?


$\sim$? – Bernard Mar 12 '21 at 14:44