Calculating the Gain in an Amplifier circuit
The gain  A of a single transistor amplifier stage is given by
$$
A = -g_m r_{out}
$$
For two stages in cascade it's the product of the gains.

The gm can be found using \$gm = I_C/V_T\$.

The output resistance is \$R_C\$ in parallel to everything else that loads the output node.

OK, here my calculation:

gm1 = 100e-6 *  q/(k*T)
gm2 = 1e-3 *  q/(k*T)
rpi2 = 100 /gm2
RC1 = 47e3;
RC2 = 4.7e3;
A1 = -gm1 * 1/(1/RC1 + 1/rpi2)
A2 = -gm2 * RC2
gain = A1 * A2


which gives the following results

gm1 =  0.0039571
gm2 =  0.039571
rpi2 =  2527.1
A1 = -9.4897
A2 = -185.98
gain =  1764.9