Question: PLEASE WRITE IN JAVA and try to explain the code Problem 1 Implement a recursive method printDigits that takes an integer num as a parameter
PLEASE WRITE IN JAVA and try to explain the code
Problem 1 Implement a recursive method printDigits that takes an integer num as a parameter and prints its digits in reverse order, one digit per line.
Problem 2 Design and implement a program that implements Euclids algorithm for finding the greatest common divisor of two positive integers. The greatest common divisor is the largest integer that divides both values without producing a remainder. An iterative version of this method was part of the RationalNumber class presented in Chapter 6. In a class called DivisorCalc, define a static method called gcd that accepts two integers, num1 and num2. Create a driver to test your implementation. The recursive algorithm is derived as follows: - gcd(num1, num2) is num2 if num2<=num1 and num2 divides num1 - gcd(num1, num2) is gcd(num2, num1) if num1 Problem 3 "Design and implement a recursive program to determine and print the Nth line of Pascal's Triangle, as shown below. Each interior value is the sum of the two values above it. Hint: use an array to store the values on each line." 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 1 7 21 35 35 21 7 1 1 8 28 56 70 56 28 8 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
