Palindromic Number

Published on 07 October 2020 (Updated: 22 January 2024)

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.

This article was written by:

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. In order to keep things simple, we split up the testing as follows:

Palindromic Number Valid Tests

Description Input Output
Sample Input: One Digit "7" "true"
Sample 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"

Palindromic Number Invalid Tests

Description Input
No Input  
Empty Input ""
Invalid Input: Not A Number "a"
Invalid Input: Negative Integer "-7"
Invalid Input: Float "5.41"

All of these tests should output the following:

Usage: please input a non-negative integer

Articles