## Program to find GCD of two polynomials

The objective is to write a program that finds greatest common divisor of two polynomials g(x) and h(x). The task does not define what form we get those two polynomials, so let's say we will get them in a form of a String, something like that: \$latex ``2x^3+5x^2+8x+3``\$ Let's start splitting our problem into chunks and gather some information about the steps we would need to implement. First, what is the greatest common divisor? In math, GCD of two or more integers, which are not all zero, is the largest positive integer that divides each of the integers (1). How do we find it? One way is to use the Euclidean algorithm. The intuition behind this algorithm is such: we have A and B numbers. We divide A by B and get C. If C is 0 - then B is our GCD. If it is not 0, then we set A to B and B to the reminder and continue operation until we get 0. \$latex gcd(a,0)=a\$ \$latex gcd(a,b)=gcd( b,a\,mod\,b )\$ Let's say we have 12 and 9. 12 mod 9 is 3. 9 mod 3 is 0. So our GCD is 3. Ok, now we know about GCD…

End of content