-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprog1_3.c
More file actions
33 lines (25 loc) · 798 Bytes
/
prog1_3.c
File metadata and controls
33 lines (25 loc) · 798 Bytes
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
27
28
29
30
31
32
33
//Include library to allow in and out functions, here printf and scanf
#include <stdio.h>
//Include library to allow math functions, here cosh
#include <math.h>
int main() {
//Variables of my name and email
char name[] = "Antoine Rakotozafy";
char email[] = "antoine.rakotozafy@gmail.com";
//Variable of the user input, the result of cosh
double x;
double result;
//Constant PI
const double PI = 3.141;
//Output of the Assignment title
printf("Assignment #1-3, %s, %s \n", name, email);
printf("Please input an integer: \n");
//User input
scanf("%lf", &x);
//Convert angle from radians to degree
x = x*PI/180;
//Calculate the hyperbolic cosine with the angle in degree
result = cosh(x);
//Print the result with 3 decimals
printf("%.3lf \n", result);
}