Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

ID: 3673079 • Letter: T

Question

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

cosx?1?x2 ?x4 ?x6 ?........ 2! 4! 6!

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.

3. The cosine of an angle can be computed from the following infinite series: cos x = 1--+ +. Q'.. 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.

Explanation / Answer

#include<iostream>

using namespace std;

int main()
{
int n, c, k, space = 1;

cout<<"This is program for outputting a diamond formation ";
cout<<"First you must select an odd number diamond width ";
cout<<"Then you must select a lateral offset even or odd ";
cout<<" Enter number of rows: ";
cin>>n;
if(n%2==0)
{
cout<<"ERROR: You entered and even number"<<endl;
cout<<"The program is correcting your error"<<endl;
n=n+1;
}
cout<<"Input lateral offset :";
cin>>space;

for (k = 1; k<=n; k++)
{
for (c = 1; c<space; c++)
cout<<" ";
space--;
for (c = 1; c<= 2*k-1; c++)
cout<<"*";
cout<<" ";
}
space = 1;
for (k = 1; k<= n - 1; k++)
{
for (c = 1; c<= space; c++)
cout<<" ";

space++;

for (c = 1 ; c<= 2*(n-k)-1; c++)
cout<<"*";

cout<<" ";
}

cout<<"Author :"<<"Noelle Belhumeur"<<endl;
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote