Skip to content

tests: add tests for GenericRoot #4276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: makeGenericRoot a proper utility class
  • Loading branch information
vil02 committed Jul 31, 2023
commit 12fbb33d5255fb7c7b7ddb23e155127346cbebfe
11 changes: 2 additions & 9 deletions src/main/java/com/thealgorithms/maths/GenericRoot.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,8 @@
* Algorithm explanation:
* https://technotip.com/6774/c-program-to-find-generic-root-of-a-number/#:~:text=Generic%20Root%3A%20of%20a%20number,get%20a%20single%2Ddigit%20output.&text=For%20Example%3A%20If%20user%20input,%2B%204%20%2B%205%20%3D%2015.
*/
public class GenericRoot {

public static void main(String[] args) {
int number1 = 1234;
int number2 = 12345;
int result1 = genericRoot(number1);
int result2 = genericRoot(number2);
System.out.println("Generic root of " + number1 + " is: " + result1);
System.out.println("Generic root of " + number2 + " is: " + result2);
public final class GenericRoot {
private GenericRoot() {
}

private static int sumOfDigits(int n) {
Expand Down