Answered step by step
Verified Expert Solution
Question
1 Approved Answer
import recursion.Recursion; // Uncomment this block of code to test Activity 4 /* System.out.println( Activity 4:); // Test factorial System.out.println(Factorial:); for (int ii = 1;
import recursion.Recursion; | |
// Uncomment this block of code to test Activity 4 | |
/* | |
System.out.println(" Activity 4:"); | |
// Test factorial | |
System.out.println("Factorial:"); | |
for (int ii = 1; ii | |
System.out.print(Recursion.fact(ii) + " "); | |
} | |
// Test fibonacci | |
System.out.println(" Fibonacci:"); | |
for (int ii = 1; ii | |
System.out.print(Recursion.fib(ii) + " "); | |
} | |
// Test Euclid's GCD algorithm | |
System.out.println(" GCD:"); | |
System.out.println ("GCD of 96 and 60 is " + Recursion.gcd(96, 60)); | |
System.out.println ("GCD of 30 and 10 is " + Recursion.gcd(30, 10)); | |
System.out.println ("GCD of 96 and 120 is " + Recursion.gcd(96, 120)); | |
// Uncomment out this block of code to test Project 4 | |
System.out.println(" Test Project 4:"); | |
System.out.println("Power:"); | |
for (int ii = 1; ii | |
for (int jj = 0; jj | |
System.out.print(ii + "^" + jj + "=" + Recursion.power(ii,jj) + " "); | |
} | |
System.out.println(); | |
} | |
*/ |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started