-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCS-LAB-1.c
27 lines (20 loc) · 823 Bytes
/
CS-LAB-1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Program Description:calculate the cosh, sinh, and tanh based off user imput
#include<math.h>
#include<stdio.h>
int main()
{
float input; //radian value
float cosh; //hyperbolic cosine
float sinh; //hyperbolic sine
float tanh; //hyperbolic tangent
printf("\nEnter value of x in radians: ");
scanf("%f", &input);
cosh = (.5) * (expf(input) + expf(-input)); //function of hyperbolic cosine
sinh = (.5) * (expf(input) - expf(-input)); //function of hyperbolic sine
tanh = ((expf(input) - expf(-input))/(expf(input) + expf(-input))); //function of hyperbolic tangent
printf("\nGiven the following value of x: %.7f",input);
printf("\nCalculated hyperbolic cosine: %.7f",cosh);
printf("\nCalculated hyperbolic sine: %.7f",sinh);
printf("\nCalculated hyperbolic tangent: %.7f\n",tanh);
return(0);
}