Given $5$ flags of different colours
We know the signal requires $2$ flags.
The number of flags possible for upper flag is $5.$
Now as one of the flag is taken, the number of flags remaining for lower flag in the signal is $4.$
The number of ways in which signal can be given
\[=\text{ }5\text{ }\times \text{ }4\text{ }=\text{ }20.\]