Define a function named sumsin that accepts double precision variable theta, double precision variable alpha, and unsigned integer n, and returns the solution of
∑ k = 0 n sin ( θ + k α )
as a double precision value using an iterative structure (i.e. a loop). Note the symbol for theta is θ, and the symbol for alpha is α. Only show the function definition. Do not write an entire program with a main function. Just write the definition for function sumsin.
in C
Ans
code:-
double sumsin(double theta,double alpha,unsigned int n){
double sum=0.0;//to store result
//sum from k=0 to n
for(unsigned int k=0;k<=n;k++){
sum=sum + sin(theta+k*alpha);
}
return sum;
}
If any doubt ask in the comments.
Get Answers For Free
Most questions answered within 1 hours.