Write a C program to determine whether a string is palindrome.

This post content:-
  • Algorithm
  • Flowchart
  • C code
  • Output
  • Pdf notes

Algorithm:-

Step 1:- start.

Step 2:- declare string.

Step 3:- Find length of str. Let length be n. 

Step 4:- Initialize low and high indexes as 0 and n-1 respectively. 

Step 5:- Do following while low index ‘l’ is smaller than high index ‘h’.

a) If str[l] is not same as str[h], then return false. 

b) Increment l and decrement h, i.e., do l++ and h–. 

Step 6:- If we reach here, it means we didn’t find a mis

 Step 7:- print string is a palindrome.

Step 8:- end.


Flowchart:-

C code:-

Output:-

Try it yourself:-

Online c compiler

Download pdf notes

Comments

Popular posts from this blog

Develop and execute C Program to Add Two Distances given in kilometer-meter Using Structures.

Develop a c program to find the sum of all elements stored in a given array using a pointer.