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

Validation ex1

parent c4e4983f
Branches
No related tags found
No related merge requests found
......@@ -9,17 +9,15 @@
*
*/
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
int32_t values_length = 8;
int32_t values[values_length];
// Reading of the 8 input values.
for (int32_t i = 0; i < values_length; i += 1) {
int32_t value;
scanf("%d", &value);
......@@ -29,6 +27,7 @@ int main() {
int32_t drop_count = 0;
int32_t drop_sum = 0;
// Count the number of drops and calculate the sum of the drops.
for (int32_t i = 1; i < values_length; i += 1) {
if (values[i] < values[i - 1]) {
drop_count += 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment