In a 250 characters or more, write a review of a development tool on DevMetric.com and be automatically entered into a drawing to win a $250 Amazon Gift Card! Write a review on an existing tool or add a new one. Entering is easy!
Can't find your tool? Select "Submit New Tool" to add a new tool and write a review.
All 250 character reviews submitted until the end of the month are instantly submitted into a drawing to win! Earn one additional entry for each review, up to 30. Drawing will occur 1 week after the contest closes and winners will be chosen based on completeness/thoroughness of review.
What does this code do?
static void mysteryFunction(int nr, int dr) { if (dr == 0 || nr == 0) { return; } if (dr % nr == 0) { System.out.print("1/" + dr / nr); return; } if (nr % dr == 0) { System.out.print(nr / dr); return; } if (nr > dr) { System.out.print(nr / dr + " + "); mysteryFunction(nr % dr, dr); return; } int n = dr / nr + 1; System.out.print("1/" + n + " + "); mysteryFunction(nr * n - dr, dr * n); } // Driver Code public static void main(String[] args) { int nr = 6, dr = 14; System.out.print("Fraction Representation of " + nr + "/" + dr + " is\n "); mysteryFunction(nr, dr); } }
Programming Language: Java