Algorithm And Flowchart Of Palindrome Number
While string length is not equal to null increment len gth.
Algorithm and flowchart of palindrome number. Input a string 2. The following algorithm is reversing an integer. An algorithm is a finite set of steps defining the solution of a particular problem. Design an algorithm draw a corresponding flowchart and write a c program to check whether a given string is a palindrome or not.
A number palindrome is a number which is the same number when the digits are taken in the reverse order. An algorithm is expressed in pseudo code something resembling c language or pascal but with some statements in english rather than within the programming language. In this lecture we ll implement our first algorithm for determining whether a string is a palindrome. If the number is negative then maintain a flag as isnegativenumber.
For example 2002 is the number palindrome of 2002. There is no number palindrome for 563. In this first algorithm we reverse the string and then compare that reversed string to the original string. Here is what we ve come up with so far following our design recipe.
Initialize i to 0 j to length 1 while i is less than length 2 1 if string i equal to string j flag 0 else. C programming code editor. The following is an example of a palindrome number. Then if the resulting reversed number is equal to the input number then it is a palindrome otherwise not.