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
f90c5dde
authored
Dec 18, 2018
by
ilahma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
d046ff05
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
Lab6/lab6_1.c
Lab6/lab6_1.c
0 → 100644
View file @
f90c5dde
#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
;
}
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