Palindromic numbers P77686


Statement
 

pdf   zip   main.cc   main.c   main.java   main.py

thehtml

Write a function that tells whether the natural number n is a palindromic number or not.

Interface

C++
bool is_palindromic(int n);
C
int is_palindromic(int n);
Java
public static boolean isPalindromic(int n);
Python
is_palindromic(n) # returns bool
 
is_palindromic(n: int) -> bool

Precondition

n is a natural number.

Observation You only need to submit the required procedure; your main program will be ignored.

Public test cases
  • Input/Output

    is_palindromic(12321) → true
    is_palindromic(0) → true
    is_palindromic(4004) → true
    is_palindromic(12) → false
    is_palindromic(100201) → false
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C C++ Java Python
    User solutions
    C C++ Java Python