Skip to content
Snippets Groups Projects
Commit 460fae1a authored by florian.burgener's avatar florian.burgener
Browse files

Exercice 1

parent 108b33d3
Branches
No related tags found
No related merge requests found
......@@ -17,29 +17,25 @@
#include <string.h>
int main() {
// int32_t values_length = 5;
// double values[values_length];
int32_t values_length = 8;
int32_t values[values_length];
// for (int32_t i = 0; i < values_length; i += 1) {
// double value;
// scanf("%lf", &value);
// values[i] = value;
// }
for (int32_t i = 0; i < values_length; i += 1) {
int32_t value;
scanf("%d", &value);
values[i] = value;
}
int32_t drop_count = 0;
int32_t drop_sum = 0;
// int32_t values_length = 5;
// int32_t values[values_length];
// for (int32_t i = 0; i < values_length; i += 1) {
// int32_t value;
// scanf("%d", &value);
// values[i] = value;
// }
// char a[100];
// int32_t b;
// scanf("%s %d", a, &b);
// printf("%s %d\n", a, b);
printf("ex1\n");
for (int32_t i = 1; i < values_length; i += 1) {
if (values[i] < values[i - 1]) {
drop_count += 1;
drop_sum += values[i - 1] - values[i];
}
}
printf("\n%d %d\n", drop_count, drop_sum);
return EXIT_SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment