write a program that prints the sine function for an input x between(0,1)
Answers
Answered by
19
Answer:
For C language
Explanation:
#include <stdio.h>
#include <math.h>
int main()
{
double sinValue, x;
printf(" Please Enter the Value to calculate Sine : ");
scanf("%lf", &x);
sinValue = sin(x);
printf("\n The Sine value of %lf = %f ", x, sinValue);
return 0;
}
For C++
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double x ;
cin >> x;
cout << "Sine value of " << x << " is "<< sin(x) << endl;
return 0;
}
Hope it helps!!!
If you want this answer in other programming language then write it in comment section :)
Answered by
0
The program in python for the given problem is,
import math
x = float(input("Enter the number ( 0-1 ) = "))
print(math.sin(x))
In the above program,
- Firstly the math module is imported for accessing the function of sine pre-defined in it.
- After that, the input is taken into the variable 'x'.
- And Finally, the print statement is used to print the value of the sine value of the inputted value of 'x'.
Similar questions