Loops – Physics – Problem #5
IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive
Difficulty: Medium
Problem Statement
Cosine function can be expressed as the following infinite series form: cosine(x) = 1 - (1/2!)x2 + (1/4!)x4 - (1/6!)x6+….. Write a C program which shall take a floating-point variable x and evaluate the above cosine series to the 5th term of the series and print the approximate value of cosine(x). Do not call the factorial function.