Write a C program that has a function that prints a table of values for sine and cosine between (0, 1)
Answers
Program:
#include <stdio.h>
#include<conio.h>
#include <math.h>
void fun(float value)
{
for(float i = 0; i <= 1; i = i + value)
{
printf("sin(%f) = %f\tcos(%f) = %f\n", i, sin(i), i, cos(i));
}
}
int main()
{
float value;
printf("Enter the desired value between 0 and 1 : ");
scanf("%f", &value);
fun(value);
return 0;
}
Output:
Enter the desired value between 0 and 1 : 0.2
sin(0.000000) = 0.000000 cos(0.000000) = 1.000000
sin(0.200000) = 0.198669 cos(0.200000) = 0.980067
sin(0.400000) = 0.389418 cos(0.400000) = 0.921061
sin(0.600000) = 0.564642 cos(0.600000) = 0.825336
sin(0.800000) = 0.717356 cos(0.800000) = 0.696707
sin(1.000000) = 0.841471 cos(1.000000) = 0.540302
Answer:give me answer
Explanation: