Adding the first coding game Challenges

This commit is contained in:
Arkagedon
2022-01-27 11:31:40 +01:00
parent 2a876df769
commit e8bac6e221
10 changed files with 421 additions and 1 deletions

View File

@ -0,0 +1,27 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
int main()
{
// game loop
while (1) {
int mountain_max = 0, mountain_Id = 0;
for (int i = 0; i < 8; i++) {
// represents the height of one mountain.
int mountain_h;
scanf("%d", &mountain_h);
if (mountain_h > mountain_max)
{
mountain_max = mountain_h;
mountain_Id = i;
}
}
printf("%d\n",mountain_Id);
}
return 0;
}