Three flags each of different colours are available for a military exercise, Using these flags different codes can be generated by waving I. Single flag of different colours II. Any two flags in a different sequence of colours. III. three…