{"id":25536462,"date":"2022-08-03T20:00:42","date_gmt":"2022-08-03T14:30:42","guid":{"rendered":"https:\/\/entri.app\/blog\/?p=25536462"},"modified":"2023-02-03T11:26:07","modified_gmt":"2023-02-03T05:56:07","slug":"palindrome-number-program-in-java-using-while-for-loop","status":"publish","type":"post","link":"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/","title":{"rendered":"Palindrome Number Program in Java Using while &amp; for Loop"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69e1662db4e09\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69e1662db4e09\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#Palindrome_Number_Algorithm\" >Palindrome Number Algorithm<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#How_to_check_whether_the_input_number_is_Palindrome_or_not\" >How to check whether the input number is Palindrome or not?\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#Palindrome_Program_in_Java_using_for_loop\" >Palindrome Program in Java using for loop<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#Implementation_of_palindrome_Method\" >Implementation of palindrome() Method<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#isPalindrome_%E2%80%93_Determine_whether_a_given_number_is_palindromic\" >isPalindrome() &#8211; Determine whether a given number is palindromic<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#Displaying_output_on_the_console\" >Displaying output on the console<\/a><\/li><\/ul><\/nav><\/div>\n<p>A palindrome number program in Java must use while and for loops to print all numbers that are palindromes, that is, those whose digits when read from left to right (top to bottom) are the same as when read from right to left (bottom to top). This article introduces a java program for palindrome that creates a palindrome number program. <span data-slate-fragment=\"JTVCJTdCJTIydHlwZSUyMiUzQSUyMnBhcmFncmFwaCUyMiUyQyUyMmNoaWxkcmVuJTIyJTNBJTVCJTdCJTIydGV4dCUyMiUzQSUyMkluJTIwdGhpcyUyMGFydGljbGUlMkMlMjB3ZSUyMHdpbGwlMjBsZWFybiUyMGhvdyUyMHRvJTIwY3JlYXRlJTIwYSUyMFBhbGluZHJvbWUlMjBOdW1iZXIlMjBQcm9ncmFtJTIwaW4lMjBKYXZhJTIwdXNpbmclMjB3aGlsZSUyMGFuZCUyMGZvciUyMGxvb3BzLiUyMEElMjBwYWxpbmRyb21lJTIwbnVtYmVyJTIwKG51bWJlciklMjB3aWxsJTIwYmUlMjBvbmUlMjB0aGF0JTIwcmVtYWlucyUyMHNhbWUlMjBhZnRlciUyMHJldmVyc2luZyUyMGl0cyUyMGRpZ2l0cy4lMjBGb3IlMjBleGFtcGxlJTJDJTIwMTIzNCUyMGFuZCUyMDIxJTIwYXJlJTIwcGFsaW5kcm9tZXMlMjB3aGVyZWFzJTIwNyUyMGFuZCUyMDglMjBhcmUlMjBub3QlMjBiZWNhdXNlJTIwdGhlaXIlMjBvcmRlciUyMG9mJTIwZGlnaXRzJTIwY2hhbmdlJTIwd2hlbiUyMHJldmVyc2VkLiUyME1vc3QlMjBvZiUyMHRoZSUyMHRpbWUlMjB3ZSUyMHVzZSUyMFN0cmluZyUyMGNsYXNzJTIwbWV0aG9kcyUyMHRvJTIwY2hlY2slMjBpZiUyMGFuJTIwaW5wdXQlMjBTdHJpbmclMjBpcyUyMGElMjBwYWxpbmRyb21lJTIwb3IlMjBub3QlMjBidXQlMjB0b2RheSUyMHdlJTIwd2lsbCUyMGxlYXJuJTIwaG93JTIwdG8lMjBkbyUyMHRoZSUyMHNhbWUlMjB0YXNrJTIwdXNpbmclMjBKYXZhJTIwcHJvZ3JhbW1pbmclMjBsYW5ndWFnZSUyMGFuZCUyMGl0cyUyMGJ1aWx0LWluJTIwZGF0YSUyMHR5cGVzJTIwc3VjaCUyMGFzJTIwY2hhciUyQyUyMGludCUyMGV0Yy4lMjIlN0QlNUQlN0QlNUQ=\">In this article, we will learn how to create a palindrome logic Number Program in Java using while and for loops. A palindrome number (number) will be one that remains the same after reversing its digits. For example, 1234 and 21 are palindromes whereas 7 and 8 are not because their order of digits changes when reversed. Most of the time we use String class methods to check if an input String is a palindrome or not but today we will learn how to do the same task using Java programming language and its built-in data types such as char, int, etc.<a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-25522670 size-full\" src=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1.png\" alt=\"Python and Machine Learning Rectangle\" width=\"970\" height=\"250\" srcset=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1.png 970w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1-300x77.png 300w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1-768x198.png 768w, https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/04\/Python-and-Machine-Learning-Rectangle-1-750x193.png 750w\" sizes=\"auto, (max-width: 970px) 100vw, 970px\" \/><\/a><\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Palindrome_Number_Algorithm\"><\/span><strong>Palindrome Number Algorithm<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>A palindrome is a word, phrase, number or another sequence of units that can be read the same way in either direction. The simplest palindromes are words or phrases that are the same whether you read them left to right or right to left. You can also create palindromes using numbers. The number 1221 is a palindrome logic, as is the number 1001. There are many ways to create palindrome numbers using Java loops. In this blog post, we&#8217;ll show you how to create a palindrome number program in java program for palindrome using both the while and for loops. If you&#8217;re not sure which loop to use, try experimenting with both. We start by declaring an int variable called i at the top of our class. We then assign it the value 0 and initialize it on our constructor method using a for a loop. For demonstration purposes, we will have I represent different values from 1-9999 during each iteration of our loop:<br \/>\nStart with i=0; for(int i=0;i&lt;10000;i++){ System.out.println(Palindrome: + String(i)); } After each iteration of the loop, we check if the current value of i matches the last digit before itself. If it does match (for example, if i is equal to 15), then all digits before the current one match up too (10). So we would add 10 to 15 and make the next iteration of our loop equal to 25 instead. When these two digits do not match up after 10 iterations, we need to make one more loop pass so that every digit has been checked at least once.<\/p>\n<p style=\"text-align: center;\"><strong><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\">Grab the opportunity to learn Java with Entri! Click Here<\/a><\/strong><\/p>\n<p><strong>Examples of Palindrome Number in Java<\/strong><\/p>\n<pre>121, 393, 34043, 111, 555, 48084<\/pre>\n<p><strong>Examples of Palindrome Number<\/strong><\/p>\n<pre> LOL, MADAM<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"How_to_check_whether_the_input_number_is_Palindrome_or_not\"><\/span><strong>How to check whether the input number is Palindrome or not?\u00a0<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>A palindrome is a word, number, phrase, or another sequence of characters that reads the same backward as forward. Given an integer, check if that integer is a palindrome or not. For this problem do consider negative numbers also. An important thing to note here is that, if the input is a single digit then it&#8217;s always a palindrome.<br \/>\nThere are many ways to solve this problem. We will discuss two methods here: using while loop and using for loop. The while loop method takes advantage of comparison with 0. The for loop method first converts number into string and reverses its value before checking whether it&#8217;s a palindrome logic or not. One more way to solve this problem is by doing a modulo operation on the number (number % 10). Note that, when performing modulo operation on 11, we get 1 and when we perform a modulo operation on 12 we get 0. Hence for every odd number (odd = 1 + 2 + 3 + 4+&#8230;) our modulo operation result will be 1 and for every even number (even = 2 + 4 + 6+&#8230;) our modulo operation result will be 0. Now use boolean variable &#8216;isPalindrome&#8217; which tells us whether given input number is a palindrome or not.<\/p>\n<p>Java program for palindrome with while loop is mentioned below;<\/p>\n<pre class=\"prettyprint linenums\">package com.guru99;\r\n \r\npublic class PalindromeNum {\r\n \r\n\tpublic static void main(String[] args)\r\n\t{\r\n \r\n\t\tint lastDigit,sum=0,a;    \r\n\t\tint inputNumber=171; \/\/It is the number  to be checked for palindrome \r\n \r\n\t\ta=inputNumber; \r\n        \r\n        \/\/ Code to reverse a number\r\n\t\twhile(a&gt;0)\r\n\t\t{   System.out.println(\"Input Number \"+a);  \r\n\t\t\tlastDigit=a%10; \/\/getting remainder  \r\n\t\t\tSystem.out.println(\"Last Digit \"+lastDigit); \r\n\t\t\tSystem.out.println(\"Digit \"+lastDigit+ \" was added to sum \"+(sum*10)); \r\n\t\t\tsum=(sum*10)+lastDigit;  \r\n\t\t\ta=a\/10;\r\n\t\t\t\r\n\t\t}    \r\n \r\n\t\t\/\/ if given number equal to sum than number is palindrome otherwise not palindrome\r\n\t\tif(sum==inputNumber)    \r\n\t\t\tSystem.out.println(\"Number is palindrome \");    \r\n\t\telse    \r\n\t\t\tSystem.out.println(\"Number is not palindrome\");    \r\n \r\n\t}\r\n \r\n}\r\n<\/pre>\n<h3>Code Output:<\/h3>\n<pre>Input Number 171\r\nLast Digit 1\r\nDigit 1 was added to sum 0\r\nInput Number 17\r\nLast Digit 7\r\nDigit 7 was added to sum 10\r\nInput Number 1\r\nLast Digit 1\r\nDigit 1 was added to sum 170\r\nNumber is palindrome<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Palindrome_Program_in_Java_using_for_loop\"><\/span><strong>Palindrome Program in Java using for loop<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>A palindrome is a word, phrase, number or another sequence of units that can be read the same way in either direction. The word palindrome was first used by the English writer Ben Jonson in 1624. The term is derived from the Greek words palindromos meaning running back or again. In programming, a palindrome is an integer that remains the same when its digits are reversed. For example, 121 is a palindrome because it&#8217;s equal to its reverse, 121. To check if an integer is a palindrome or not, we can use for loop to iterate over the number and check if the first digit is equal to the last digit and so on. To do this, we will create a function called isPalindrome which takes in an int as parameter and returns true if the number passed is a palindrome otherwise false. First, let\u2019s import java.util.*; Then let\u2019s create our function with one parameter called isPalindrome. If the given number cannot be divided by 2 then return false else proceed with remainder. For every iteration, check if current digit (n) equals previous digit (n-1). If both digits are equal then return true else return false<\/p>\n<pre class=\"prettyprint linenums\"> \r\npublic class PalindromeNum {\r\n \r\n\tpublic static void main(String[] args)\r\n\t{\r\n \r\n\t\tint lastDigit,sum=0,a;    \r\n\t\tint inputNumber=185; \/\/It is the number  to be checked for palindrome \r\n \r\n\t\ta=inputNumber; \r\n        \r\n        \/\/ Code to reverse a number\r\n\tfor( ;a != 0; a \/= 10 )\r\n\t\t{   System.out.println(\"Input Number \"+a);  \r\n\t\t\tlastDigit=a%10; \/\/getting remainder  \r\n\t\t\tSystem.out.println(\"Last Digit \"+lastDigit); \r\n\t\t\tSystem.out.println(\"Digit \"+lastDigit+ \" was added to sum \"+(sum*10)); \r\n\t\t\tsum=(sum*10)+lastDigit;  \r\n\t\t\ta=a\/10;\r\n\t\t\t\r\n\t\t}    \r\n \r\n\t\t\/\/ if given number equal to sum than number is palindrome otherwise not palindrome\r\n\t\tif(sum==inputNumber)    \r\n\t\t\tSystem.out.println(\"Number is palindrome \");    \r\n\t\telse    \r\n\t\t\tSystem.out.println(\"Number is not palindrome\");    \r\n \r\n\t}\r\n \r\n}\r\n\r\n<\/pre>\n<h3>Code Output:<\/h3>\n<pre>Input Number 185\r\nLast Digit 5\r\nDigit 5 was added to sum 0\r\nInput Number 1\r\nLast Digit 1\r\nDigit 1 was added to sum 50\r\nNumber is not palindrome<\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\"><strong>Learn to code from industry experts! Enroll here<\/strong><\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Implementation_of_palindrome_Method\"><\/span><strong>Implementation of palindrome() Method<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The isPalindrome() method is used to check whether a number is a palindrome or not. A palindrome number is a number that remains the same even when its digits are reversed. For example, 121 is a palindrome number but 112 is not. The method returns true if the number is a palindrome and false if it is not. If the digit at index i (starting from 1) is greater than 10, then we subtract 10 from this digit so that all of our digits fall between 0-9. We then compare the new digit with the old one (digit at index i-1). If they are equal then we have found a palindrome number! Else, the number is not a palindrome. Here&#8217;s how you can implement this program using a while loop:<br \/>\nThe code starts by declaring an int variable called num which stores the inputted number. Next, we use the conditional operator ?: to test whether the string returned by System.out.println(num) is equal to . It&#8217;s just a shorthand way of writing if (System.out.println(num) == &#8221;). Finally, we return either true or false depending on what was found during execution of the conditional statement above.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"isPalindrome_%E2%80%93_Determine_whether_a_given_number_is_palindromic\"><\/span><strong>isPalindrome() &#8211; Determine whether a given number is palindromic<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>A palindromic number is a number that remains the same when its digits are reversed. For example, 121 is a palindromic number but 112 is not. The easiest way to check if a number is palindromic is to reverse it and compare it to the original number. If they are the same, then it&#8217;s a palindrome. You can write a program to check if a number is palindromic using either a while loop or a for loop. Let&#8217;s take a look at how to do this with each type of loop. Here&#8217;s an example of a while loop:<br \/>\nint n = 3;<br \/>\nwhile (n != 0) {<br \/>\nSystem.out.println(The number + n + is not a palindrome.);<br \/>\nn = n \/ 10;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Displaying_output_on_the_console\"><\/span><strong>Displaying output on the console<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>A palindrome is a word, phrase, number or another sequence of units that can be read the same way in either direction. A classic example is A man, a plan, a canal: Panama.<br \/>\nIn programming, we often encounter situations where we need to check if a given string is a palindrome or not. This can be done using various looping constructs like while and for loop. In this blog post, we will see how to write a palindrome program in Java using both while and for loop.<br \/>\nThe output of the program should be something like this: Input = racecar<br \/>\nOutput = racecar<br \/>\nInput = Java2s<br \/>\nOutput = Java2s<br \/>\nInput = to be or not to be<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center;\"><strong><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\">Learn Coding in your Language! Enroll Here!<\/a><\/strong><\/p>\n<h4><strong>Related Articles<\/strong><\/h4>\n<table dir=\"ltr\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col width=\"329\" \/>\n<col width=\"309\" \/><\/colgroup>\n<tbody>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Syllabus&quot;}\" data-sheets-hyperlink=\"https:\/\/entri.app\/blog\/kerala-psc-village-field-assistant-vfa-syllabus-exam-pattern\/\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/java-program-to-check-if-a-number-is-positive-or-negative\/\" target=\"_blank\" rel=\"noopener\">Java Program to Check if a Number is Positive or Negative<\/a><\/strong><\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Mock Test&quot;}\" data-sheets-hyperlink=\"https:\/\/entri.app\/blog\/kerala-psc-vfa-free-mock-test\/\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/what-is-an-armstrong-number-armstrong-number-program-in-python\/\" target=\"_blank\" rel=\"noopener\">Python Program to Check Armstrong Number<\/a><\/strong><\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Exam Date&quot;}\" data-sheets-hyperlink=\"https:\/\/entri.app\/blog\/kerala-psc-vfa-exam-date\/\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/java-developer-salary-in-india\/\" target=\"_blank\" rel=\"noopener\">Java Developer Salary in India in 2023<\/a><\/strong><\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Video Course&quot;}\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/armstrong-number-program-in-java\/\" target=\"_blank\" rel=\"noopener\">Armstrong Number Program in Java<\/a><\/strong><\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Application Form&quot;}\" data-sheets-hyperlink=\"https:\/\/entri.app\/blog\/kerala-psc-vfa-apply-online\/\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/factorial-program-in-java\/\" target=\"_blank\" rel=\"noopener\">Program to Find factorial of a number in Java<\/a><\/strong><\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Study Materials&quot;}\" data-sheets-hyperlink=\"https:\/\/entri.app\/blog\/kerala-psc-vfa-study-material\/\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/how-to-learn-to-code-in-java-all-you-need-to-know\/\" target=\"_blank\" rel=\"noopener\">How to Learn to Code in Java<\/a><\/strong><\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Vacancy&quot;}\" data-sheets-hyperlink=\"https:\/\/entri.app\/blog\/kerala-psc-vfa-vacancy\/\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/online-java-programing-course-in-india\/\" target=\"_blank\" rel=\"noopener\">Online Java Programing Course in India<\/a><\/strong><\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Interview Questions&quot;}\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/program-to-find-sum-of-n-natural-numbers-in-java\/\" target=\"_blank\" rel=\"noopener\">Program to Find Sum of N Natural Numbers in Java<\/a><\/strong><\/td>\n<\/tr>\n<tr>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Admit Card&quot;}\" data-sheets-hyperlink=\"https:\/\/entri.app\/blog\/kerala-psc-vfa-admit-card\/\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/program-for-fibonacci-series-in-java\/\" target=\"_blank\" rel=\"noopener\">Program for Fibonacci Series in Java<\/a><\/strong><\/td>\n<td data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;Kerala PSC VFA Job Profile&quot;}\" data-sheets-hyperlink=\"https:\/\/entri.app\/blog\/kerala-psc-vfa-job-profile\/\"><strong><a class=\"in-cell-link\" href=\"https:\/\/entri.app\/blog\/what-is-java-programming\/\" target=\"_blank\" rel=\"noopener\">What is Java Programming? Feature, History<\/a><\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>A palindrome number program in Java must use while and for loops to print all numbers that are palindromes, that is, those whose digits when read from left to right (top to bottom) are the same as when read from right to left (bottom to top). This article introduces a java program for palindrome that [&hellip;]<\/p>\n","protected":false},"author":93,"featured_media":25536479,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[802,1864,1882,1883,1881],"tags":[],"class_list":["post-25536462","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles","category-data-science-ml","category-java-programming","category-react-native","category-web-android-development"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Palindrome Number Program in Java using While Loop- Entri Blog<\/title>\n<meta name=\"description\" content=\"This article introduces a java program for palindrome that creates a palindrome number program. A palindrome is a word, phrase, number or another sequence of units that can be read the same way in either direction.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Palindrome Number Program in Java using While Loop- Entri Blog\" \/>\n<meta property=\"og:description\" content=\"This article introduces a java program for palindrome that creates a palindrome number program. A palindrome is a word, phrase, number or another sequence of units that can be read the same way in either direction.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/\" \/>\n<meta property=\"og:site_name\" content=\"Entri Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/entri.me\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-03T14:30:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-03T05:56:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-2022-08-03T191002.854-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"820\" \/>\n\t<meta property=\"og:image:height\" content=\"615\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Akhil M G\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@entri_app\" \/>\n<meta name=\"twitter:site\" content=\"@entri_app\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Akhil M G\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/\"},\"author\":{\"name\":\"Akhil M G\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/875646423b2cce93c1bd5bc16850fff6\"},\"headline\":\"Palindrome Number Program in Java Using while &amp; for Loop\",\"datePublished\":\"2022-08-03T14:30:42+00:00\",\"dateModified\":\"2023-02-03T05:56:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/\"},\"wordCount\":1402,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-2022-08-03T191002.854-1.png\",\"articleSection\":[\"Articles\",\"Data Science and Machine Learning\",\"Java Programming\",\"React Native\",\"Web and Android Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/\",\"url\":\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/\",\"name\":\"Palindrome Number Program in Java using While Loop- Entri Blog\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-2022-08-03T191002.854-1.png\",\"datePublished\":\"2022-08-03T14:30:42+00:00\",\"dateModified\":\"2023-02-03T05:56:07+00:00\",\"description\":\"This article introduces a java program for palindrome that creates a palindrome number program. A palindrome is a word, phrase, number or another sequence of units that can be read the same way in either direction.\",\"breadcrumb\":{\"@id\":\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#primaryimage\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-2022-08-03T191002.854-1.png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-2022-08-03T191002.854-1.png\",\"width\":820,\"height\":615,\"caption\":\"Palindrome Number Program in Java Using while & for Loop\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/entri.app\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Entri Skilling\",\"item\":\"https:\/\/entri.app\/blog\/category\/entri-skilling\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Java Programming\",\"item\":\"https:\/\/entri.app\/blog\/category\/entri-skilling\/java-programming\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Palindrome Number Program in Java Using while &amp; for Loop\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/entri.app\/blog\/#website\",\"url\":\"https:\/\/entri.app\/blog\/\",\"name\":\"Entri Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/entri.app\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/entri.app\/blog\/#organization\",\"name\":\"Entri App\",\"url\":\"https:\/\/entri.app\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"width\":989,\"height\":446,\"caption\":\"Entri App\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/entri.me\/\",\"https:\/\/x.com\/entri_app\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/875646423b2cce93c1bd5bc16850fff6\",\"name\":\"Akhil M G\",\"url\":\"https:\/\/entri.app\/blog\/author\/akhil\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Palindrome Number Program in Java using While Loop- Entri Blog","description":"This article introduces a java program for palindrome that creates a palindrome number program. A palindrome is a word, phrase, number or another sequence of units that can be read the same way in either direction.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/","og_locale":"en_US","og_type":"article","og_title":"Palindrome Number Program in Java using While Loop- Entri Blog","og_description":"This article introduces a java program for palindrome that creates a palindrome number program. A palindrome is a word, phrase, number or another sequence of units that can be read the same way in either direction.","og_url":"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/","og_site_name":"Entri Blog","article_publisher":"https:\/\/www.facebook.com\/entri.me\/","article_published_time":"2022-08-03T14:30:42+00:00","article_modified_time":"2023-02-03T05:56:07+00:00","og_image":[{"width":820,"height":615,"url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-2022-08-03T191002.854-1.png","type":"image\/png"}],"author":"Akhil M G","twitter_card":"summary_large_image","twitter_creator":"@entri_app","twitter_site":"@entri_app","twitter_misc":{"Written by":"Akhil M G","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#article","isPartOf":{"@id":"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/"},"author":{"name":"Akhil M G","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/875646423b2cce93c1bd5bc16850fff6"},"headline":"Palindrome Number Program in Java Using while &amp; for Loop","datePublished":"2022-08-03T14:30:42+00:00","dateModified":"2023-02-03T05:56:07+00:00","mainEntityOfPage":{"@id":"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/"},"wordCount":1402,"commentCount":0,"publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"image":{"@id":"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-2022-08-03T191002.854-1.png","articleSection":["Articles","Data Science and Machine Learning","Java Programming","React Native","Web and Android Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/","url":"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/","name":"Palindrome Number Program in Java using While Loop- Entri Blog","isPartOf":{"@id":"https:\/\/entri.app\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#primaryimage"},"image":{"@id":"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-2022-08-03T191002.854-1.png","datePublished":"2022-08-03T14:30:42+00:00","dateModified":"2023-02-03T05:56:07+00:00","description":"This article introduces a java program for palindrome that creates a palindrome number program. A palindrome is a word, phrase, number or another sequence of units that can be read the same way in either direction.","breadcrumb":{"@id":"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#primaryimage","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-2022-08-03T191002.854-1.png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/Untitled-2022-08-03T191002.854-1.png","width":820,"height":615,"caption":"Palindrome Number Program in Java Using while & for Loop"},{"@type":"BreadcrumbList","@id":"https:\/\/entri.app\/blog\/palindrome-number-program-in-java-using-while-for-loop\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/entri.app\/blog\/"},{"@type":"ListItem","position":2,"name":"Entri Skilling","item":"https:\/\/entri.app\/blog\/category\/entri-skilling\/"},{"@type":"ListItem","position":3,"name":"Java Programming","item":"https:\/\/entri.app\/blog\/category\/entri-skilling\/java-programming\/"},{"@type":"ListItem","position":4,"name":"Palindrome Number Program in Java Using while &amp; for Loop"}]},{"@type":"WebSite","@id":"https:\/\/entri.app\/blog\/#website","url":"https:\/\/entri.app\/blog\/","name":"Entri Blog","description":"","publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/entri.app\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/entri.app\/blog\/#organization","name":"Entri App","url":"https:\/\/entri.app\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","width":989,"height":446,"caption":"Entri App"},"image":{"@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/entri.me\/","https:\/\/x.com\/entri_app"]},{"@type":"Person","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/875646423b2cce93c1bd5bc16850fff6","name":"Akhil M G","url":"https:\/\/entri.app\/blog\/author\/akhil\/"}]}},"_links":{"self":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25536462","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/users\/93"}],"replies":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/comments?post=25536462"}],"version-history":[{"count":10,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25536462\/revisions"}],"predecessor-version":[{"id":25552475,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25536462\/revisions\/25552475"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media\/25536479"}],"wp:attachment":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media?parent=25536462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/categories?post=25536462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/tags?post=25536462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}