Task:
given numbers a and b. Decide in the integers equation Ax + B = 0. Display everything
integer solutions for this equation, if their number of course, output
the word “no” if there are no solutions, output the word “inf”, if integer
solutions infinitely a lot.
Input:
Two integers are introduced, not exceeding 30000 in absolute
Value.
Output:
Display the answer to the task.
Examples:
-
Enter:
6 -2.
Conclusion:
no
-
Enter:
1 -7.
Conclusion:
7
What is wrong with the code? It gives out that the answer is incorrect:
a = int (input ())
B = INT (INPUT ())
IF a! = B:
IF B% a == 0:
Print (-b // a)
ELSE:
PRINT ('NO')
IF B == 0:
PRINT ('INF')
ELSE:
PRINT ('NO')
Answer 1, Authority 100%
a = int (input ())
B = INT (INPUT ())
if (a == 0 and b == 0):
PRINT ('INF')
ELIF (A == 0 OR (B% A)! = 0):
PRINT ('NO')
ELSE:
Print (int (-b / a))