-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmath_functions.c
More file actions
31 lines (28 loc) · 992 Bytes
/
Copy pathmath_functions.c
File metadata and controls
31 lines (28 loc) · 992 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
#include <math.h>
#include <stdio.h>
/* random math functions */
int main() {
double A = sqrt(9);
// -> 3 same as square root of 9
double B = pow(2, 4);
// -> 16 same as 2**4
int C = round(3.14);
// -> 3 rounds the number duh, basically 2.3 rounds to and 2.5 rounds to 3 when using round()
int D = ceil(3.14);
// -> 4 rounds it up
int E = floor(3.99);
// -> 3 always round it down
double F = fabs(-100);
// -> 100 find absoloute value of a number (how far away it is from 0 (so it will take
// any negative numbers and make them positive))
double G = log(3);
// -> 1.098612 gets the log of a number
double H = sin(45);
// -> 0.850904 its in the name, its sine
double I = cos(45);
// -> 0.525322 again, its cosine
double J = tan(45);
// -> 1.619775 wowy its tangnet
printf("%lf", J);
return 0;
}