Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. [25 pts] Write two programs to calculate the factorial of a given input integer in two ways: a. Use a for loop b.
1. [25 pts] Write two programs to calculate the factorial of a given input integer in two ways: a. Use a for loop b. Use recursion Your results variable must be an unsigned long long (64b). Test your programs and make sure they work. What is the maximum input value without causing an overflow (results needs to be correct)? After testing your programs, you will use a Linux system utility/command called "time" to time these two programs with the maximum input value. Run these two programs 5 times each with "time". Record your results and calculate the average of these runs for each program. Turn in a table of your timing values. Discuss what you have observed. 2. [25 pts] Change you program to have results in "double". What is the max input value not resulting in "inf"? Run your two programs with the max input value 5 times each and record the running time with the Linux system command "time". Discuss what you have observed from these results. Turn in your program as well as screen capture for running your program besides answering questions and discussion.
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