Why can’t I simply find the answer by cout<<(input/5)+(input/25);
please explain it to me somebody? Why do I need to divide it if I can find the answer by doing the above method. But if I am trying to do (input/5)+(input/25)
I am getting WA. Please help!
show us full code and problem link . single line of code doesnt determine error
you need to check for more higher powers of 5
because if n would be 1000 then multiples will be
1000/5 + 1000/25 + 1000/125 + 1000/625 + 1000/3125 upto infinity
but
all terms after 1000/3125 including it becomes zero, so sol is
1000/5 + 1000/25 + 1000/125 + 1000/625