Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
mahunt
/
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
820e5f7d
authored
6 years ago
by
mahunt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all
parent
2d64ad47
master
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
0 deletions
Lab5/praticalTask1.c
Lab5/praticalTask2.c
Lab5/praticalTask1.c
0 → 100644
View file @
820e5f7d
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int
main
()
{
int
n
;
int
i
;
int
j
;
printf
(
"Please enter an array length: "
);
scanf
(
"%d"
,
&
n
);
int
arr
[
n
];
for
(
i
=
0
;
i
<
n
;
i
++
)
{
printf
(
"Please enter a value for position %d: "
,
i
);
scanf
(
"%d"
,
&
arr
[
i
]);
}
int
swap
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
j
=
0
;
j
<
n
-
1
;
j
++
)
{
if
(
arr
[
j
]
<
arr
[
j
+
1
])
{
swap
=
arr
[
j
];
arr
[
j
]
=
arr
[
j
+
1
];
arr
[
j
+
1
]
=
swap
;
}
}
}
for
(
i
=
0
;
i
<
n
;
i
++
)
{
printf
(
"
\n
"
);
printf
(
"%d"
,
arr
[
i
]);
}
return
0
;
}
This diff is collapsed.
Click to expand it.
Lab5/praticalTask2.c
0 → 100644
View file @
820e5f7d
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int
main
()
{
double
vert
[
4
][
3
]
=
{
{
1
,
4
,
6
,
},
{
2
,
-
3
,
1
,},
{
3
,
5
,
0
,
},
{
3
,
1
,
-
3
}
};
double
mag1
;
double
mag2
;
double
dotPro
[
6
];
double
result
[
6
];
int
i
;
int
j
;
int
k
=
0
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
j
=
i
+
1
;
j
<
4
;
j
++
)
{
mag1
=
sqrt
((
vert
[
i
][
0
]
*
vert
[
i
][
0
]
+
vert
[
i
][
1
]
*
vert
[
i
][
1
]
+
vert
[
i
][
2
]
*
vert
[
i
][
2
]));
mag2
=
sqrt
((
vert
[
j
][
0
]
*
vert
[
j
][
0
]
+
vert
[
j
][
1
]
*
vert
[
j
][
1
]
+
vert
[
j
][
2
]
*
vert
[
j
][
2
]));
dotPro
[
k
]
=
((
vert
[
i
][
0
]
*
vert
[
j
][
0
])
+
(
vert
[
i
][
1
]
*
vert
[
j
][
1
])
+
(
vert
[
i
][
2
]
*
vert
[
j
][
2
]))
/
(
mag1
*
mag2
);
k
++
;
}
}
for
(
i
=
0
;
i
<
6
;
i
++
)
{
result
[
i
]
=
acos
(
dotPro
[
i
]);
printf
(
" %lf,"
,
result
[
i
]);
}
}
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