Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phkarl
/
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
952314c7
authored
Oct 01, 2018
by
phkarl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
6e8f8f8c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
Lab5PracticeTask2.c
Lab5PracticeTask2.c
0 → 100644
View file @
952314c7
#include <stdio.h>
#include <math.h>
int
main
(){
int
matrix
[
4
][
3
]
=
{
{
1
,
4
,
6
},
{
2
,
-
3
,
1
},
{
3
,
5
,
0
},
{
3
,
1
,
-
3
}
};
int
j
;
int
n
;
int
q
;
int
p
;
int
dot
;
int
lenSq1
;
int
lenSq2
;
double
angle
;
printf
(
"vector1 vector2 angle in degree
\n
"
);
for
(
j
=
0
;
j
<
4
;
j
=
j
+
2
){
for
(
n
=
0
;
n
<
4
;
n
++
){
if
(
n
!=
j
){
int
x1
=
matrix
[
j
][
0
];
int
y1
=
matrix
[
j
][
1
];
int
z1
=
matrix
[
j
][
2
];
int
x2
=
matrix
[
n
][
0
];
int
y2
=
matrix
[
n
][
1
];
int
z2
=
matrix
[
n
][
2
];
dot
=
x1
*
x2
+
y1
*
y2
+
z1
*
z2
;
lenSq1
=
x1
*
x1
+
y1
*
y1
+
z1
*
z1
;
lenSq2
=
x2
*
x2
+
y2
*
y2
+
z2
*
z2
;
angle
=
acos
(
dot
/
sqrt
(
lenSq1
*
lenSq2
));
angle
=
angle
*
(
180
.
0
/
3
.
14159265
);
for
(
q
=
0
;
q
<
3
;
q
++
){
printf
(
"%d "
,
matrix
[
j
][
q
]);
}
printf
(
" "
);
for
(
p
=
0
;
p
<
3
;
p
++
){
printf
(
"%d "
,
matrix
[
n
][
p
]);
}
printf
(
" "
);
printf
(
"%f
\n
"
,
angle
);
}
}
}
return
0
;
}
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