Design And Analysis Of Algorithm
Implement following algorithm in iterative and recursive manner: A. GCD algorithm B. Factorial algorithm C. Fibonacci algorithm Factorial Algorithm import java.util.Scanner; public class Factorial { public static void main ( String [] args ) { int choice ; Scanner scanner = new Scanner ( System . in ); do { System . out . print ( "Enter a number: " ); int number = scanner . nextInt (); System . out . println ( "Select an approach:" ); System . out . println ( "1. Iterative" ); System . out . println ( "2. Recursive" ); System . out . println ( "3.Stop the Program" ); System . out . print ( "Enter your choice: " ); choice = scanner . nextInt (); ...