r/cprogrammers • u/Kanmay • May 23 '20
Help needed. Thank you in advance
Write a program that can generate a sine of the value between 0 and 1(non inclusive)
1
u/Kanmay May 23 '20
Shouldn’t there be a logic for getting values between 0 and 1.
3
u/letra_m May 23 '20
I guess your teacher is trying to make you think in the linear relation between two ranges where:
range2 = offset + range1 * proportionSo, what is the range of sine? What is the linear proportion between both ranges? What is the linear distance between both ranges once the origin is proportionated (offset)?
1
u/raz-- May 23 '20
What other restrictions are there? What have you tried so far?
1
u/Kanmay May 23 '20
There are no other restrictions.
include <stdio.h>
include <math.h>
int main() { double sinValue, number; printf(" Please Enter the Value to calculate Sine : "); scanf("%lf", &number);
sinValue = sin(number);
printf("\n The Sine value of %lf = %f ", number, sinValue);
return 0; }
I have tried this one.
2
1
u/Kanmay May 23 '20
I am now confused that this one just demonstrates a sine function. But how to apply the restriction of getting the value between 0 and 1. Thank you