That's an algorithm we use subconciously everyday, and we don't even know it
Strange reasoning. So only algorithms in every day practice are allowed in programming?
I wonder what would happen if you apply that to physics, how do you determine the number of atoms in a gram of matter? You count them one by one, because that is what you do in every day practice!
OK, maybe i described it in the wrong way.
Of course it's not only the algorithms in every day practice.
I was referring to the problem at hand! Quote: "In THIS case, many forget...."
Hands up, who in such a case uses the Modulo-way, and who uses the "String-Operations"-way....
If i do online-banking, and the bank asks me for the last four digits of my credit-card-number, i don't do math. I do String-Operations, "writeln(Right(CreditCardNumber.ToString, 4));"
And in every programming-problem, which has user-interaction (and printing something on a screen is User-Interaction), is the first step to ask: How would i do it without a computer?
This is homework-assignment, and he doesn't even know what he'd be doing in real-life to solve the problem.
Define the problem in real-life, translate it to computer-programming, and in such cases you end up with String-Operations in 99% of cases.
My Opinion