Question
This homework contains three cases as the follows Casel: Primality test Case 2: Factorial, and Case 3: Fibonacci sequence For each case, we want to
This homework contains three cases as the follows Casel: Primality test Case 2: Factorial, and Case 3: Fibonacci sequence For each case, we want to plot input (n x-axis) verses execution time (t = y-axis). Each of the above cases has two programs to solve the corresponding problem. We want to compare the behavior of both programs (i.e. practical comparison) by prepare a figure using Excel. Each figure should have two lines, one for the first program and the other for the second program. In addition to the figures, provide the collected data in separated tables Case 1: Check whether a number is Prime or not. Recall that an integer n is prime if it is evenly divisible only by 1 und n. code slag met riscatto 1 - preta 1 Case 2: Compute the factorial of an integer. The factorial of an integer can be found using an iterative program or a recursive program Programist wamesegamat start Case 3: Fibonacci numbers is famous formula in mathematics that generates a sequence of numbers in which the next number is computed hased on the previous two numbers (1.1.2.3.3.8.13.21.34...) Pyram ga include tempat wing numperat tait As A-BAU- Bo che Al-AFAS 1 1 1 2:00 eclass.ppu.edu be found using an iterative program or a recursive program. open include include singing for Case 3: Fibonacci numbers is famous formula in mathematics that generates a sequence of numbers in which the next number is computed based on the previous two numbers (1.1.2.3.5.8.13.21.34... Thoram trocasive neug (Dysme go include wiege BAH NAFAS riieren 1 1 de A SMA 1 For each case, you need to submit a figure and two tables. The following is an illustration of what is required for case The above figure is just an example that has been drawn by hand, but in your case, you must make it using Excel. Of course, you need to add some C++ statements to measure how long cach program takes This homework contains three cases as the follows. Casel: Primality test Case 2: Factorial, and Case 3: Fibonacci sequence For each case, we want to plot input (n=x-axis) verses execution time (t = y-axis). Each of the above cases has two programs to solve the corresponding problem. We want to compare the behavior of both programs (i.e. practical comparison) by prepare a figure using Excel. Each figure should have two lines, one for the first program and the other for the second program. In addition to the figures, provide the collected data in separated tables. Case 1: Check whether a number is Prime or not. Recall that an integer n is prime if it is evenly divisible only by 1 and n. Program 1(2...) Program 2 (2.) Wincludeiostream include sostream using namespace std. #include\"input>;i++)>+)>\"prime\":>\"prime\":>\"not>\"not> using namespace std; using namespace std; main int factfint n) 4 int nifact-1: if (0) cout> else for(i=1;in;i++) return n'fact(n-1) fact-facii: coutfact: main int n; cout\":>(n):> #include >n: for (int i=0;i++) for (int i0;i;i++)>;>\">\"input>\"input>
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