Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ilahma
/
iax0583
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0a4c902c
authored
6 years ago
by
ILaha AHmadzada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload divide
parent
45c67cc6
master
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
dividefunction.c
dividefunction.c
0 → 100644
View file @
0a4c902c
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
float
angle
(
int
a
[],
int
b
[]);
int
main
()
{
int
matrix
[
4
][
3
]
=
{{
1
,
4
,
6
},
{
2
,
-
3
,
1
},
{
3
,
5
,
0
},
{
3
,
1
,
-
3
}};
int
start
=
1
;
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
for
(
int
j
=
start
;
j
<
4
;
j
++
)
{
printf
(
"%f
\n
"
,
angle
(
matrix
[
i
],
matrix
[
j
]));
}
start
++
;
}
return
0
;
}
int
dot
(
int
a
[],
int
b
[])
{
int
dot
=
0
;
int
i
;
for
(
i
=
0
;
i
<
3
;
i
++
){
dot
+=
a
[
i
]
*
b
[
i
];
}
return
dot
;
}
float
m
(
int
a
[])
{
return
sqrt
(
pow
(
a
[
0
],
2
)
+
pow
(
a
[
1
],
2
)
+
pow
(
a
[
2
],
2
));
}
float
angle
(
int
a
[],
int
b
[])
{
return
acos
(
dot
(
a
,
b
)
/
(
m
(
a
)
*
m
(
b
)))
*
180
/
M_PI
;
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment