Question: use java in java Task# 4 Printing a string backwards can be done iteratively or recursively. To do it recursively, think of the following specification:

use java
in java
Task# 4 Printing a string backwards can be done iteratively or recursively. To do it recursively, think of the following specification: If S contains any characters i.e., is not the empty string) print the last character in s print s string in backwards The program prompts the user for a string, and then calls method printBackwards method to print the string backwards. The printBackwards methods prints the string in backwards using the recursive strategy outlined above Task# 5 Factorial Function: You have probably seen the factorial function before. It is defined for all integers greater or equal to zero: For example, factorial( 5 ) = 5 * factorial( 4 ) = 5* (4 * factorial( 3 )) = 5* ( 4* (3 * factorial( 2 ))) = 5 * ( 4* (3 * (2 * factorial( 1 )))) = 5* ( 4* (3* (2* (1* factorial(0) = 5* ( 4* (3* (2* (1*1)))) = 5*4*3*2*1*1 = 120 factorial( 0 ) = 1 // Base Case Often factorial(N) is written as N! factorial(N) = N * factorial(N-1)// Recursive Case
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
