Previous Next
0 / 20
Module DEMO-32-59DEMO-C-32

Palindrome Number Checker using for

DEMO-C-32 β€’ Programming in C

Browser-only practice

Problem Statement

Write a C program that determines whether a given integer is a palindrome. A palindrome number reads the same backward as forward (e.g., 121, 1331, 7).

Your program should read an integer from standard input and output one of the following messages:

  • "PALINDROME" if the number is a palindrome
  • "NOT PALINDROME" if the number is not a palindrome

Important Requirements:

  • You must use loops only (no recursion)
  • You cannot convert the number to a string
  • You must handle negative numbers appropriately (negative numbers are not palindromes)
  • You must handle the special case of 0 correctly

Examples:

  • 121 β†’ PALINDROME
  • -121 β†’ NOT PALINDROME
  • 123 β†’ NOT PALINDROME
  • 0 β†’ PALINDROME
  • 1001 β†’ PALINDROME

Input Format

A single integer N on standard input (-1000000 ≀ N ≀ 1000000)

Output Format

Print exactly one line containing either "PALINDROME" or "NOT PALINDROME" (without quotes)

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
121
PALINDROME
121 reads the same forwards and backwards, so it's a palindrome
Sample #2
Public sample
0
PALINDROME
0 is considered a palindrome
Sample #3
Public sample
123
NOT PALINDROME
123 does not read the same forwards and backwards, so it's not a palindrome
Sample #4
Public sample
-121
NOT PALINDROME
Negative numbers are not considered palindromes

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings