- 1

# a task

The volunteers are divided into 5 groups with an equal number of people in each. If there are less than 5 people in any group, then in order to restore the number, it is necessary to recruit more volunteers. Write a program that takes the actual number of volunteers as input and prints to the console the number of volunteers that need to be recruited so that there are equal numbers of volunteers across all 5 groups. Sample input 24 Sample output one Explanation The closest number to 24, a multiple of 5 - 25, so we need 1 more volunteer (24 + 1 = 25) so that all 5 groups have an equal number. Use modulo division (%). You cannot use conditions and cycles. https://code.sololearn.com/cP2lfCVGlVA5/?ref=app

29th Jun 2021, 7:37 AM
RayDallince
11 Answers
+ 1
well, you have posted your attempt ^^ you don't have to use 25, as this is only the task example number ;) % is used to get reminder of whole division... so to get the number of volunteers that are missing, you must output 5 - (volunters_numbers % 5) ;)
29th Jun 2021, 8:12 AM
visph
+ 1
where is your code attempt?
29th Jun 2021, 7:43 AM
visph
+ 1
we are not free code providers, and you are here to learn... so you must try to code it by yourself, not requesting other to do the task for you ^^ however, if you provide your code attempt, then we could guide you to complete the task by yourself ;P
29th Jun 2021, 7:48 AM
visph
+ 1
Yes, visph is right. You should first try and solve your task by yourself. If you get stuck and really need someoneâ€™s help, then only ask for help.
29th Jun 2021, 7:53 AM
Arseni
0
yes I tried, it seems simple, but how exactly I donâ€™t know
29th Jun 2021, 7:58 AM
RayDallince
0
you have deleted your answer to my first post where you said "there's no it"... and now you say you tried, but still not providind your code attempt ^^
29th Jun 2021, 8:01 AM
visph
0
I meant I didn't save the code.
29th Jun 2021, 8:07 AM
RayDallince
0
visph Seems to me he just wants the answerðŸ˜‘
29th Jun 2021, 8:07 AM
Arseni
0
yes, to understand how this could be solved using only (%)
29th Jun 2021, 8:09 AM
RayDallince
0
how could I not have thought of (. thanks.
29th Jun 2021, 8:17 AM
RayDallince
0
function main() { var numberVolunteers = parseInt(readLine(), 10) var x = (numberVolunteers % 5); var y = (numberVolunteers % 5 == 0) ? 0 : 5 - x; console.log(y); }
29th Jun 2021, 8:21 AM
RayDallince