Assuming the flag is rectangular in shape, area of a rectangle = length times width. Perimeter of a rectangle = 2L + 2W, where L is the length and W is the width. Therefore, you have two equations.
A = LW = 840
P = 2L + 2W = 118
You can solve the first equation for either L or W. Let's say we solve it for W.
LW = 840
W = 840/L
Now, plug this value of W into the perimeter equation.
2L + 2W = 2L + 2(840/L) = 118
Now, solve that equation for L. Once you have L, you can find W.