Programming contests

50 Programming Exercise for Beginners

January 2, 2019, 12:00 AM – December 31, 2019, 12:00 AM

Relative Primes

Write a program that reads two positive integers from the standard input and decides whether they are relative primes or not.

Input Specification

The input contains two positive integers separated by a space character.

Output Specification

The program should write a single line to the standard output containing the string „IGEN” („yes” in Hungarian) or „NEM” („NO” in Hungarian) depending on whether the two input numbers are relative primes.

Sample Input 1

  1. 15 10
download as text file

Output for Sample Input 1

  1. NEM
download as text file

Sample Input 2

  1. 2 7
download as text file

Output for Sample Input 2

  1. IGEN
download as text file
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