Question

The cosine of an angle can be computed from the following infinite series:

{eq}displaystyle cos x = 1-frac{x^2}{2!}+ frac{x^4}{4!}- frac{x^6}{6!}+cdots

{/eq}

Write a program that reads an angle x (in radians) from the keyboard. Then, in a function compute the cosine of the angle using first five terms of the series. Print the value computed along with the value of the cosine computed using the C++ library function.

EXPERT ANSWER

A program in Programming Language