Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

program in c. please paste code, thanks! CS 153 Program 4 - Stirling Approximation (separate compilation) 1. Write a pure function double factoriallint Ni that

image text in transcribedprogram in c. please paste code, thanks!

CS 153 Program 4 - Stirling Approximation (separate compilation) 1. Write a pure function double factoriallint Ni that computes N! N 10234 ... N-1)'N Do this the obvious way by initializing a product to one and then multiplying the integers together using a loop. Zero factorial is defined to be one. Now write a pure function double atining in Ni that uses the Stirling approximation to compute: approx[e!) - V22) In this formula, n is an integer, and e is base of the natural logarithm. Use the pre-processor constants from math.h: ME and M_PL Don't even dream of typing in your own literals, . Write your own function de la myPon (double x, int that computes Do this in a counting loop. Don't use the library function powil. Assume that n is a non-negative integer. Use your function Pow(in your function for the Stirling approximation. Put all three functions in a source file atirling Fun.c. This file will need some include files at the top. Except for debugging, don't have main) in this file 2. Create a header file still marun.ls that contains prototypes for three functions 3. Write a main function that asks the user for N, and then writes out a table forn from 1 to N where each line hasnt, and the Stirling approximation ton! Of course, for fairly small, will overflow. Put main in a source file called stirlingen. This file will need appropriate header files, including the one from above. Your three files should all be in the same subdirectory. Try to make the output look reasonably neat at least for small values of N You will need to fiddle with formats with printf. Compile your files and link them together using C:\CSourcege string Puno stilingain. n! Approx. 0.0000 1307674368000 1300430722199.4680 Use ANSI-C syntax Compile and run using the goc environment. Do not mix tabs and spaces in the source file. Debug thoroughly. Turn in three source files named as above using Blackboard

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Power Of Numbers In Health Care A Students Journey In Data Analysis

Authors: Kaiden

1st Edition

8119747887, 978-8119747887

More Books

Students also viewed these Databases questions