Skip to content
Open
Changes from all commits
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
25 changes: 25 additions & 0 deletions src/org/launchcode/java/demos/thehuxleymeeseeks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package gtrgrt;

import java.util.*;

public class HuxleyCode {

public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n1 = in.nextInt();
int n2 = in.nextInt();
int n3 = in.nextInt();
System.out.println(oi(n1, n2, n3));
}

public static int oi (int n1, int n2, int n3) {
int resultado = 0;
if (n1 >= n3) {
resultado = n1 - n3 + (n1 * n2);
} else {
resultado = oi(n1 * n2, n2, n3 - n1);
}

return resultado;
}
}