0

Why this code encounter EOFError?

It encounters no Error in PyCharm but it says here: EOFError: When reading a line. num_one = int(input("Enter first number: ")) num_two = int(input("Enter second number: ")) if num_one < num_two: temp = num_one else: temp = num_two while num_one % temp != 0 or num_two % temp != 0: temp = temp - 1 lcm = (num_one * num_two) / temp print("GCD of %d and %d is %d" % (num_one, num_two, temp)) print("And their LCM is %d" % lcm)

11th Apr 2017, 7:47 PM
Rezwan Ahammed Tuhin
Rezwan Ahammed Tuhin - avatar
1 Odpowiedź
+ 4
It works, but the submit pop-up is weird on SoloLearn. To make it work, enter a number, make a new line and enter the second number, then hit submit. I tried it with 3 7 and got the correct answer, 21.
11th Apr 2017, 8:16 PM
Tob
Tob - avatar