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 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.

Flowchart of Palindrome Program using for loop 

palindrome program in c, cpp with flowchart
Figure: Palindrome program in C++ with the flowchart.

Palindrome Program using for loop for checking the numbers as a palindrome

Output

palindrome program flowchart cpp, c
Figure: palindrome program flowchart CPP, C.

Palindrome Program using for loop for checking the strings as a palindrome

 

Write a C++ program to show whether a number is a palindrome or not using a do-while loop?

Flowchart of Palindrome Program using do while loop 

Flowchart of C++ program to show whether a number is a palindrome or not using a do-while loop

Code of Palindrome Program using do while loop 

Output

enter number

575

The number is a palindrome:

Suppose the input value is: 121

Excercise

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 executionCondition

Num !=0

What line will execute?Operations performed
1st timeTrue1,2,3,4,5,6,7,8,9,10,11,12,13,14,15r=12%10=2

sum=0*10+2=2

num=121/10=12

2nd timeFalse1,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 timefalse1,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

 

 

Palindrome recursion C++

 

Palindrome Program in C

Output

palindrome program flowchart cpp, c
Figure: palindrome program flowchart CPP, C.

Subscribe for Friendship

Latest posts by Prof. Fazal Rehman Shamil (see all)

Buy advertisement space on T4Tutorials

For more details email [email protected]