Let n be the Greatest Common Divisor (GCD)
one polygon has 5n sides, while the other has 4n sides.
We know that the sum of exterior angles of each (convex) polygon is 360 degree
The exterior angle of the regular 5n-sided polygon is 360/5n
Similarly, the exterior angle of the regular 4n-sided polygon is 360/4n
The difference between the corresponding exterior angles is 6 degree
So, the numbers of sides are 3*4 = 12 and 3*5 = 15.