# Palindrome Program in C, C++, C Plus Plus (CPP) with flow chart

How to check if a sentence is a palindrome in C++?

We need to read from left and right, if the word is the same, whether we read it from left or we read it from right, then its called palindrome.

Example of palindrome

For example, “t4tutorials” is not a palindrome but “t4t” is a palindrome.

## Code of Palindrome Program using do-while loop

Output

enter number

575

The number is a palindrome:

Suppose the input value is: 121

## Exercise

Find the possible mistakes in the following Shamil’s Flow Table of the program to show whether a number is a palindrome or not using a do-while loop?

 Loop execution Condition Num !=0 What line will execute? Operations performed 1st time True 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 r=12%10=2 sum=0*10+2=2 num=121/10=12 2nd time False 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,9,10, 11,12,13,14,15, 16,17,18,19,22 r=1%10=1 sum=12*10+1=121 num=12/10=1 2nd time false 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,9,10, 11,12,13,14,15, 16,20,21,22

Output

Output