|
|||
Relative Prime NumberCreate a program that recognizes the relative prime numbers. Two numbers are relatively prime if they have no factors in common other than 1. Input SpecificationEach input line consists of two positive integers separated by a space. Sample Input
Output SpecificationFor each line, print one line to the output containing “YES” if the line contains relative primes or “NO” otherwise. Output for Sample Input
Hints and GuideThe problem can be solved by calculating the greatest common divisor of each pair of positive integers. The Euclidean algorithm based on the subtraction operation is widely known and applicable on positive integers: subtract the lower component of the pair from the greater one until the components become equal. If the algorithm stops with one, then the greatest common divisor of the original pair of positive integers is 1, hence they are relative primes. It is recommended to create an individual One possible solution is available in: main.c.
Acknowledgement
This work was supported by the construction EFOP-3.4.3-16-2016-00021. The project was supported by the European Union, co-financed by the European Social Fund.
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |