Design a site like this with WordPress.com
Get started

Day 75: “When You Assume…”

If I were a freelance developer, I recon I’d have an upset client on my hands.

The task WeirdBeardDev posed in a comment earlier today was:

Take a number, 1742 and reverse it, 2471. Sum them together, 4213. See if the sum is a palindrome (read the same forward and backward, i.e., 1221). If yes then great. If not, repeat until 1000 iterations or until it is.

So after work this evening I merrily hobbled together a progam using just syntax I remembered. (I’m too ashamed to post the code without completely refactoring it – I know I can clean it up) Below is the output after running it four different times:

(User enters 4 digits. The program concatinates the digits, displays the reverse and sum, and checks whether the 4 or 5 digit sum is a palindrome)

But then I stared at the last part of the task to work on next: “If not, repeat until 1000 iterations or until it is” and realized I hadn’t understood the request properly and based it off several assumptions.

Oops.

Current Progress Status

  • Tower Defense Tutorial: 69/73
  • C# The Yellow Book (pg 127/216)

Onward!

Advertisement
%d bloggers like this: