Question: #include #include #include #include ../include/cis1057.h /* * Programmer: < < MA >> * Class: Introduction to C Programming 1057 Spring 2019 Section 004 * Assignment:

#include #include #include #include "../include/cis1057.h" /* * Programmer: << MA >> * Class: Introduction to C Programming 1057 Spring 2019 Section 004 * Assignment: Number 5 estimate the value of a factorial using Gosper's algorithm." * Date: << 02-19-2019 >> * Version: 1 * Description: Program will prompt for some data, read in the values, perform the calculation using library math functions, and display the result. * File: lab5.c */ # define M_PI 3.14159265358979323846 /* pi */ # define M_E 2.7182818284590452354 /* e */ # define N_COEFF 2 # define CONST 1 int prompt_and_return_integer( const char *prompt ); double estimate_gospers_algorithm( const double n ); void display_results( const double answer ); int main () { const char prompt_1; double A,B ; B = prompt_and_return_integer(&prompt_1); A = estimate_gospers_algorithm(B); display_results(A); return EXIT_SUCCESS; } int prompt_and_return_integer( const char *prompt ) { printf("Please enter a positive integer: "); scanf("%lf", &*prompt); return *prompt; } double estimate_gospers_algorithm( const double n ) { double squrt_partial; // Gosper's formula under the square root, leaves out PI double squrt_solved; // sqrt_part square rooted double my_result; // powers multipled by the solved square root double n_power; double e_power; squrt_partial = (N_COEFF * n) + CONST; squrt_solved = sqrt(squrt_partial * M_PI); n_power = pow(n,n); e_power = pow(M_E,-n); return n_power * e_power * squrt_solved; } void display_results( const double answer ) { printf( " the factorial is %0.2f. ", answer); return; }

my output is coming wrong can somebody help me to fix the problem?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!