+ 1

Guys Help Me

Why my program is not displaying all that is needed to be displayed, Example I entered 5 as my array size and input all the 5 elements: 1 1 1 2 3 Expected Output Should be: Value. Ocurrence 1 2 2 1 3 1 It only displayed Value Occurrence 1 3 https://code.sololearn.com/ct1I7c0z01p5/?ref=app https://code.sololearn.com/ct1I7c0z01p5/?ref=app

28th Oct 2020, 12:13 PM
Jan Patrick Urbano
Jan Patrick Urbano - avatar
2 Antworten
+ 1
You didn't reset your flag to 1 in the loop. Try to add flag = 1 at the beginning of the loop.
28th Oct 2020, 12:25 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 3
as already mentioned by CarrieForle , you are not reseting your "flag" back to a non-zero value, so as soon as a number repeats, it will remain false for all the remaining iterations also. Here is the fix 👇 https://code.sololearn.com/c4V5gRZePPvD/?ref=app
28th Oct 2020, 12:26 PM
Arsenic
Arsenic - avatar