SATISH KUMAR’s Post

Day 8 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to check whether a number is a palindrome without converting it into a string. A palindrome number is a number that reads the same forward and backward. What the program does: • Takes an integer input from the user • Reverses the number using mathematical operations • Compares the reversed number with the original number • Determines whether the number is a palindrome How the logic works: The original number is stored in a variable for later comparison A variable is initialized to store the reversed number Using a while loop, the last digit is extracted using modulo (n % 10) The digit is added to the reversed number after shifting its place value The number is reduced using integer division (n // 10) Finally, the original number is compared with the reversed number Examples: 1)Input: 12321 Output: 12321 is a palindrome 2)Input: 180018 Output: 180018 is not a palindrome Key learnings from Day 8: – Using modulo and integer division effectively – Reversing numbers without string conversion – Strengthening loop and arithmetic logic – Writing efficient and clean Python code #100DaysOfCodeChallenge #Day8 #PythonLearning #CorePython #LogicBuilding #ProgrammingBasics #DSAinPython #AlgorithmicThinking #CodingDaily #LearnByDoing #StudentCoder #FutureSoftwareEngineer #TechSkills #ComputerScience #VITBhopal #CSEStudent #AIandML

  • text

To view or add a comment, sign in

Explore content categories