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.

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

c++ palindrome do while loop
c++ palindrome do while loop
palindrome program in c++ using while loop
palindrome program in c++ using while loop

 

c++ palindrome program without arrays
c++ palindrome program without arrays

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

 

 

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

Palindrome Program in C++ using user define function

Output

Please! Enter the Num: 4
4 is a palindrome Num.

——————————–

Palindrome recursion C++

 

Palindrome Program in C

Output

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

Add a Comment