In: Computer Science
Define a function named sumsinconv that accepts double precision variable theta, double precision variable alpha, and unsigned integer n, and returns the solution of expression
sin ( ( n + 1 ) α 2 ) sin ( θ + n α 2 ) sin ( α 2 )
in C
Only show the function definition. Do not write an entire program with a main function. Just write the definition for function sumsinconv.
C CODE( function sumsinconv)
float sumsinconv(double teta, double alpha,unsigned int
n)
{
double
sol=sin((n+1)*alpha*alpha)*(sin(teta+n*alpha*alpha))*sin(alpha*alpha);
// expression for sin ( ( n + 1 ) α 2 ) sin ( θ + n α 2 ) sin
( α 2 )
return sol;
}
FULL CODE
#include<stdio.h>
#include <math.h>
float sumsinconv(double teta, double alpha,unsigned int n);
void main()
{
double teta;
double alpha;
unsigned int n;
printf("\nEnter the value of teta:"); //input the values
scanf("%lf",&teta);
printf("\nEnter the value of alpha:");
scanf("%lf",&alpha);
printf("\nEnter the value of n :");
scanf("%d",&n);
double r=sumsinconv(teta,alpha,n); //function call
printf("\n solution for expression :%lf",r); //display output
}
float sumsinconv(double teta, double alpha,unsigned int
n)
{
double
sol=sin((n+1)*alpha*alpha)*(sin(teta+n*alpha*alpha))*sin(alpha*alpha);
// expression for sin ( ( n + 1 ) α 2 ) sin ( θ + n α 2 ) sin
( α 2 )
return sol;
}
I hope the answer is clear and satisfactory . If you have any doubts feel free to ask in the comment section. Please give a thumbs up.