Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
chazog
/
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
fdd306ae
authored
Dec 16, 2018
by
chazog
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
87b99b3b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
Lab5/Task1.c
Lab5/Task1.c
0 → 100644
View file @
fdd306ae
#include <stdio.h>
#include <math.h>
int
main
()
{
// Declaration
int
N
;
int
i
;
int
j
;
printf
(
"Enter size of array: "
);
scanf
(
"%d"
,
&
N
);
// Declare array
int
arr
[
N
];
// Imput values in array
i
=
0
;
while
(
i
<
N
)
{
printf
(
"Enter value in array: "
);
scanf
(
"%d"
,
&
arr
[
i
]);
i
++
;
}
i
=
0
;
while
(
i
<
N
)
{
j
=
0
;
while
(
j
<
N
-
1
)
{
if
(
arr
[
j
]
<
arr
[
j
+
1
])
{
int
swap
=
arr
[
j
];
arr
[
j
]
=
arr
[
j
+
1
];
arr
[
j
+
1
]
=
swap
;
}
j
++
;
}
i
++
;
}
for
(
i
=
0
;
i
<
N
;
i
++
)
{
printf
(
"%d "
,
arr
[
i
]);
}
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