Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
progseq-controle_continue_2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
dario.genga
progseq-controle_continue_2
Commits
01e37c19
Commit
01e37c19
authored
3 years ago
by
dario.genga
Browse files
Options
Downloads
Patches
Plain Diff
Add ex1
parent
1760db67
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ex1/ex1.c
+25
-0
25 additions, 0 deletions
ex1/ex1.c
with
25 additions
and
0 deletions
ex1/ex1.c
+
25
−
0
View file @
01e37c19
...
@@ -9,5 +9,30 @@
...
@@ -9,5 +9,30 @@
#include
<stdbool.h>
#include
<stdbool.h>
int
main
()
{
int
main
()
{
const
int
ARRAY_LENGTH
=
8
;
int
*
array
=
malloc
(
sizeof
(
int
)
*
ARRAY_LENGTH
);
int
drop_count
=
0
;
int
drop_total_value
=
0
;
// Get the values
for
(
int
i
=
0
;
i
<
ARRAY_LENGTH
;
i
++
)
{
int
value
;
scanf
(
"%d"
,
&
value
);
array
[
i
]
=
value
;
}
// Parse the values
for
(
int
i
=
1
;
i
<
ARRAY_LENGTH
;
i
++
)
{
if
(
array
[
i
]
<
array
[
i
-
1
])
{
drop_count
++
;
drop_total_value
+=
array
[
i
-
1
]
-
array
[
i
];
}
}
// Display the results
printf
(
"%d %d
\n
"
,
drop_count
,
drop_total_value
);
// Free the memory and exit the program
free
(
array
);
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment