There are some workarounds, each with their own limitations.
One possibility is to declare e as a number using alsodigit={e}. This has the disadvantage that other uses of e are also treated as a number.
A second possibility is to define e followed by a number to be emphasized, and to set emphasis as \color{black}. Unfortunately listings can't use regular expressions (although see a possible approach in Can the listings package highlight by regexp?) so the disadvantage is that you have to set every exponent explicitly.
A third possibility is to escape to LaTeX manually to set the color using an escape character. Preferably this character should be something that is not used in regular code, for example the greek letter φ for C. The disadvantage is that you have to do this for each exponent in your code.
Alternatively, you can use minted.
MWE:
\documentclass{article}
\usepackage{listings}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{minted}
\lstset{
basicstyle=\ttfamily,
columns=fullflexible,
keepspaces=true,
upquote=true,
showstringspaces=false,
language=c,
commentstyle=\color{olive},
keywordstyle=\color{blue},
identifierstyle=\color{violet},
stringstyle=\color{purple},
directivestyle=\color{teal},
}
\begin{document}
\begin{lstlisting}[alsodigit={e}]
#include <stdio.h>
int main()
{
int a = 20000;
double b = 20e3;
double c = 20e30;
float example = 0;
printf("%d %f\n", a, b);
return 0;
}
\end{lstlisting}
\begin{lstlisting}[emph={e1,e2,e3,e4,e5,e6,e7,e8,e9,e10},emphstyle=\color{black}]
#include <stdio.h>
int main()
{
int a = 20000;
double b = 20e3;
double c = 20e30;
float example = 0;
printf("%d %f\n", a, b);
return 0;
}
\end{lstlisting}
\begin{lstlisting}[escapechar={φ}]
#include <stdio.h>
int main()
{
int a = 20000;
double b = φ20e30φ;
float example = 0;
printf("%d %f\n", a, b);
return 0;
}
\end{lstlisting}
\begin{minted}[style=perldoc]{c}
#include <stdio.h>
int main()
{
int a = 20000;
double b = 20e3;
double c = 20e33;
float example = 0;
printf("%d %f\n", a, b);
return 0;
}
\end{minted}
\end{document}
Result:
