Palindromic Number in Every Language

Published on 07 October 2020 (Updated: 10 October 2022)

Palindromic Number in Every Language

Welcome to the Palindromic Number page! Here, you’ll find a description of the project as well as a list of sample programs written in various languages.

Description

A palindromic number is a number that reads the same backward and forward. Example: 343, 121, 909, 222

Requirements

To implement this algorithm, your program should accept a positive integer from the command line as follows:

./palindromic-number.lang 56765

And report whether or not that number is a palindrome using the values “true” and “false.” See testing below for examples.

Testing

Every project in the Sample Programs repo should be tested. In this section, we specify the set of tests specific to Palindromic Number. To keep things simple, we split up testing into two subsets: valid and invalid. Valid tests refer to tests that occur under correct input conditions. Invalid tests refer to tests that occur on bad input (e.g., letters instead of numbers).

Valid Tests

Description Positive Integer Output
sample input: one digit 7 true
sampel input: even digits 2442 true
sample input: odd digits 232 true
sample input: even digits not palindrome 5215 false
sample input: odd digits not palindrome 521 false

Invalid Tests

Description Input
no input None
empty input ””
invalid input: not a number a
invalid input: negative number -5
invalid input: float 5.41

All invalid tests should spit out a usage statement in the following form:

Usage: please input a non-negative integer

Articles