I know that this problem has been proven before in this forum, but I would like to try two other ways.
First, I would like to use an isomorphism between $\mathbb{Q}$ and $H\times K$ to get homomorphisms $\pi_H: \mathbb{Q}\rightarrow H$ and $\pi_k:\mathbb{Q}\rightarrow K$. I think kernels of these homomorphisms will be able to prove this. However, I'm not sure how to follow through with this.
Another method would be: Assume not, so there do exist non-trivial subgroups $H, K$ such that $\mathbb{Q}\cong H\times K$. Let $a\in H, b\in K$ be nontrivial elements. Then $\langle(a,1),(1,b)\rangle\cong\mathbb{Z}\times\mathbb{Z}$. The group $\mathbb{Z}\times\mathbb{Z}$ is not cyclic, while every finitely generated subgroup of $\mathbb{Q}$ is cyclic, so we have a contradiction. Is this proof correct?
Thanks in advance.
On first method: suppose that $\Bbb Q = G \times H$. Then $G, H < \Bbb Q, G \cap H = 0.$ Take two elements $a/b = g \in G, c/d = h \in H$. Then $g^{bc} = h^{ad} = ac$ contradicting trivial intersection.
Another proof is correct too, but to verify that every finitely generated subgroup of $\Bbb Q$ is $\Bbb Z$, you do essentialy same thing as above.