-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.c
More file actions
59 lines (50 loc) · 1.26 KB
/
functions.c
File metadata and controls
59 lines (50 loc) · 1.26 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include <errno.h>
void birthday(char name[],int age){
printf("\nHappy birthday dear %s!",name);
printf("\nYou are %d years old!",age);
};
// function declaration
double square(double x){
// function body
//local variable declaration
double result = x * x;
// return statement
return result;
};
int main() {
char name[] = "John";
int age = 25;
birthday(name,age);
double x = square(3.14);
printf("%lf",x);
double A = sqrt(9);
double B = pow(2,4);
int C = round(3.24); // rounds down
int D = ceil(3.14); // always rounds up
int E = floor(3.99); // always rounds down
double F = abs(-100);
double G = log(3);
double H = sin(45);
double I = cos(45);
double J = tan(45);
printf("%lf\n",A);
printf("%lf\n",B);
printf("%d\n",C);
printf("%d\n",D);
printf("%d\n",E);
printf("%lf\n",F);
printf("%lf\n",G);
printf("%lf\n",H);
printf("%lf\n",I);
printf("%lf\n",J);
return 0;
}
// Bro Code. (2021.10.7.). C Programming Full Course for free [Video]. YouTube. https://www.youtube.com/watch?v=87SH2Cn0s9A