fork(6) download
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static bool IsGoodDivision(int a, int b)
  6. {
  7. while (b % 2 == 0) { b /= 2; }
  8. while (b % 5 == 0) { b /= 5; }
  9. return a % b == 0;
  10. }
  11.  
  12. public static void Test(int a, int b)
  13. {
  14. Console.WriteLine("{0}/{1} {2} good.", a, b, IsGoodDivision(a, b) ? "is" : "is not");
  15. }
  16.  
  17. public static void Main()
  18. {
  19. Test(1, 4);
  20. Test(1, 8);
  21. Test(47, 183);
  22. Test(58, 889);
  23. Test(1, 5);
  24. }
  25. }
  26.  
Success #stdin #stdout 0.03s 36968KB
stdin
Standard input is empty
stdout
1/4 is good.
1/8 is good.
47/183 is not good.
58/889 is not good.
1/5 is good.