Friday, April 26, 2024
HomeC ProgrammingPalindromic Numbers | C For Dummies Weblog

Palindromic Numbers | C For Dummies Weblog


I feel most youngsters delight at discovering the palindrome, the place a phrase or phrase comprises the identical letters learn ahead or backwards. For instance, racecar, which is actually two phrases however by no means thoughts! Think about how such enjoyable will be spoiled by making use of the identical rule to a quantity.

A palindromic quantity is one which’s decimal illustration reads the identical ahead as backwards. For instance, 123321. In contrast to cyclops numbers (from final month’s Train), these values needn’t have an odd variety of digits. In reality, the primary 9 numbers are all thought-about palindromic, although the identical rule doesn’t apply to written palindromes (most likely as a result of it requires little effort).

Anyhoo, your activity for this month’s Train is to output the primary 100 palindromic numbers, beginning with (disappointingly) one. Your resolution should devise a technique to make sure that the digits on one aspect of the worth match these on the opposite aspect. This situation is current for values with odd and even digits, so have enjoyable with that half.

Determine 1 reveals the output from my resolution.

Determine 1. Output from my resolution, utilizing a desk borrowed from final month’s resolution.

Be certain that you don’t simply code the output textual content as your resolution! No, it’s important to do programming and calculations and stuff. I’ll publish my resolution in per week.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments