On the ring $R=F[x_1,\dots ,x_n]$ of polynomials in n variables over a field $F$ special isomorphisms $A$'s of $R$ into $R$ are defined which preserve the greatest common divisor of two polynomials. The ring $R$ is extended to the ring $S\:=F[[x_1,\dots ,x_n]]^+$ and the ring $T\:=F[[x_1,\dots ,x_n]]$ of generalized polynomials in such a way that the exponents of the variables are non-negative rational numbers and rational numbers, respectively. The isomorphisms $A$'s are extended to automorphisms $B$'s of the ring $S$. Using the property that the isomorphisms $A$'s preserve GCD it is shown that any pair of generalized polynomials from $S$ has the greatest common divisor and the automorphisms $B$'s preserve GCD. On the basis of this Theorem it is proved that any pair of generalized polynomials from the ring $T=F[[x_1,\dots ,x_n]]$ has a greatest common divisor.