mirror of
https://github.com/Oxbian/CodingGame.git
synced 2025-07-07 20:33:02 +02:00
update codingame challenges
Adding python challenges and sorting the challenges
This commit is contained in:
27
C/Easy_Challenges/the_descent.c
Executable file
27
C/Easy_Challenges/the_descent.c
Executable 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;
|
||||
}
|
Reference in New Issue
Block a user