Linear equation. Write a program that solves a linear equation ax = b in integers. Given two integers a and b (a may be zero), print a single integer root if it exists and print “no solution” or “many solutions” otherwise.
Input |
Output |
1 |
-2 |
2 |
no solution |
5 |
3 |
-5 |
-6 |
-7 |
1 |