Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The letters in red is what needs to be changed and filled with the proper C++ Code (compiler: CodeLite) Thank you, The code below defines

The letters in red is what needs to be changed and filled with the proper C++ Code (compiler: CodeLite)

Thank you,

image text in transcribedimage text in transcribed

The code below defines a function that returns the factorial of N. nment: I: The program below calculates the value of the sine of an angle entered in degrees, such as 32.13 using the provided factorial function. \#include \#include \#define PI 22/7 // Define the factorial function long factorial(int N){ int factN=1; if (N!=0 \&\& N!=1) for (int i=N;i>1;i ) factN=i; return factN; \} int main() \{ /I Variable declarations double thetad, thetar, term, sine =0.0; int n=0; // Prompt the user to enter the value of the angle in degrees puts("enter an appropriate prompt text for the angle value"); // Capture the input value scanf("\%lf", \&thetad); // Convert the entered angle into radians thetar = thetad * PI/180.0; do \{ term = powf (1,n)powf( thetar, 2n+1)/ factorial (2n+1); sine = sine + term; ++n; \} while (fabs( term )>0.0001) // Display the values of the entered angle and the sine value printf("The sine value of the \%lf angle is = \%lfln", variables to display); printf("Number of terms use to generate the answer is \%dln", variables to display); printf("The sine value of the \%lf angle using the built-in sine function is \%lfin", variables to display); \}return0 Test the code with the following sets of values: 1. =32.13 2. =32.13 3. =112.46 II: Write a C program that uses the above function to calculate the cosine value of any angle . The program must include - - Input statements with appropriate prompt that reads the value of the angle in degrees - Calculates the sine \& cosine values of by using the 'factorial' function defined above accurate to 3 decimal locations - Descriptive output statement(s) that print the values of (in degrees) and the cosine

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

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

How will the members be held accountable?

Answered: 1 week ago

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago