A Collection of Code Snippets in as Many Programming Languages as Possible

This project is maintained by TheRenegadeCoder

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:

- Jeremy Grifski

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

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.

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
- Palindromic Number Invalid 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" |

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
```

- Palindromic Number in Algol68
- Palindromic Number in Beef
- Palindromic Number in C
- Palindromic Number in C++
- Palindromic Number in Commodore Basic
- Palindromic Number in Euphoria
- Palindromic Number in Java
- Palindromic Number in Javascript
- Palindromic Number in Julia
- Palindromic Number in Kotlin
- Palindromic Number in Mathematica
- Palindromic Number in Pascal
- Palindromic Number in Perl
- Palindromic Number in Php
- Palindromic Number in Python
- Palindromic Number in Rust
- Palindromic Number in Typescript