Let $G=(V,E)$ be a finite connected graph, and let $kappa: Vrightarrow mathbb{R}$ be a function such that $int_Vkappa dmu<0$. We consider the following Kazdan-Warner equation on $G$:[Delta u+kappa-K_lambda e^{2u}=0,] where $K_lambda=K+lambda$ and $K: Vrightarrow mathbb{R}$ is a non-constant function satisfying $max_{xin V}K(x)=0$ and $lambdain mathbb{R}$. By a variational method, we prove that there exists a $lambda^*>0$ such that when $lambdain(-infty,lambda^*]$ the above equation has solutions, and has no solution when $lambdageq lambda^ast$. In particular, it has only one solution if $lambdaleq 0$; at least two distinct solutions if $0<lambda<lambda^*$; at least one solution if $lambda=lambda^ast$. This result complements earlier work of Grigoryan-Lin-Yang cite{GLY16}, and is viewed as a discrete analog of that of Ding-Liu cite{DL95} and Yang-Zhu cite{YZ19} on manifolds.