0

[SOLVED] Qualifying for the Olympics

I'm trying to complete the "Qualifying for the Olympics" task in C#, as described below: The qualifiers for the Olympiad lasts 3 days, and one winner is selected each qualifying day. the jagged array you are given represent the list of all participants, divided by the number of days (there are three arrays inside the main one, each representing the participants who took part that day) Write a program to take the numbers of each days winners as input and output them. Sample input 2 3 4 Sample output Bridgette Ramona Fran Mayur Kristian Dana Explanation Day 1 winner is Bridgette Ramona (2nd participant on day 1) Day 2 winner is Fran Mayur (3rd participant on day 2) Day 3 winner is Kristian Dana (4th participant on day 3) I've written this code https://code.sololearn.com/cA3A198a214A and as far as i can tell it works fine. however when i run it in the task itself, its saying 1,2,3 and 5 are working, but isn't accepting case number 4. anyone have any thoughts on what's causing this please? PS i thought it might be the else statements as the task doesn't ask for them, but after commenting them out, its still not accepting case 4.

18th May 2021, 6:03 AM
Andrew Hall
Andrew Hall - avatar
2 Answers
+ 4
Just use this no need to use if-else Console.WriteLine(olympiad[0][day1Winner-1]); Console.WriteLine(olympiad[1][day2Winner-1]); Console.WriteLine(olympiad[2][day3Winner-1]);
18th May 2021, 6:17 AM
TOLUENE
TOLUENE - avatar
+ 1
brilliant. thank you! much more concise, and it works for the challenge 👍 ive updated the code to reflect this change if anyone else is struggling with this one.
18th May 2021, 8:49 AM
Andrew Hall
Andrew Hall - avatar