Computer Programming C Laboratory: Practical C Programs

Write a program in C to find whether the given string is palindrome or not

C Program with Algorithm, Flowchart, Output

Simple C Program with Algorithm, Flowchart, Output - Computer Programming - C

Write a program in C to find whether the given string is palindrome or not.


AIM

To write a program to check given string is palindrome or not.


ALGORITHM

Step‒1 : Start

Step-2 : Read string

Step-3 : Call function is Palindrome with string

Step-4 : If the return value of function is True, Print Palindrome

Step-5 : If False, Print Not Palindrome

Step-6 : Stop

Step‒1 : Find length of the string into len

Step-2 : Check whether the len is equal to zero

Step-3 : If step‒2 is True, return True

Step-4 : Compute right = len‒1

Step-5 : Check the value of left is less than right and the variable matched is True

Step-6 : If step‒5 is True do step‒7 to step‒9

Step-7 : Check string[left] is not equal to string[right]]

Step-8 : If step‒7 is True, assign matched = false

Step-9 : If step‒7 is False, increment left by 1, decrement right by 1

Step‒10 : Return matched


FLOWCHART



PROGRAM

#include<stdio.h>

#include<string.h>

enum boolean {false,true};

enum Boolean ispalindrome (char string[])

{

int left,right,len=strlen(string);

enum Boolean matched = true;

if(len==0)

       return true;

left =0; right = len ‒ 1;

while(left < right && matched)

{

if(string[left] != string[right] )

       matched = false;

else

{

     left++; right‒‒;

}

}

return matched;

}

void main()

{

char string[40];

printf("Enter the string to check palindrome or not.\n");

printf("Enter a string :");

scanf("%s",string);

if(ispalindrome (string))

      printf("The given string %s is a palindrome. \n",string);

else

      printf("The given string %s is not a palindrome. \n",string);

}


OUTPUT

Enter the string to check palindrome or not.

Enter a string :madam

The given string madam is a palindrome.

 

Computer Programming C Laboratory: Practical C Programs : Tag: C Programming : C Program with Algorithm, Flowchart, Output - Write a program in C to find whether the given string is palindrome or not


Computer Programming C Laboratory: Practical C Programs



Under Subject


Computer Programming C

CS25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Computer Programming C Laboratory

CS25C01 1st Semester EEE, ECE, CSE, CSE(CY), AIDS, IT practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation



Related Subjects


English Essentials I

EN25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


தமிழர் மரபு - Heritage of Tamils

UC25H01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Applied Calculus

MA25C01 Maths 1 M1 - 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Applied Physics I

PH25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Applied Chemistry I

CY25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Makerspace

ME25C04 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Computer Programming C

CS25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Computer Programming Python

CS25C02 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Fundamentals of Electrical and Electronics Engineering

EE25C03 1st Semester EEE Depart | 2025 Regulation | 1st Semester 2025 Regulation


Introduction to Mechanical Engineering

ME25C03 1st Semester Mechanical Dept | 2025 Regulation | 1st Semester 2025 Regulation


Introduction to Civil Engineering

CE25C01 1st Semester Civil, Agri Departments | 2025 Regulation | 1st Semester 2025 Regulation


Essentials of Computing

CS25C03 1st Semester - AIDS, CSE, CSE(CY), IT Department | 2025 Regulation | 1st Semester 2025 Regulation


Applied Physics I Laboratory

PH25C01 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation


Applied Chemistry I Laboratory

CY25C01 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation


Computer Programming C Laboratory

CS25C01 1st Semester EEE, ECE, CSE, CSE(CY), AIDS, IT practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation


Computer Programming Python Laboratory

CS25C02 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation


Engineering Drawing

ME25C01 EEE, Mech, Agri, EEE Depts | 2025 Regulation | 2nd Semester 2025 Regulation


Basic Electronics and Electrical Engineering

EE25C04 1st Semester ECE Dept | 2025 Regulation | 1st Semester 2025 Regulation


Essentials of Computing - Laboratory

CS25C03 1st Semester AIDS, CSE, CSE(CY), IT Depts | practical Laboratory Manual | 2025 Regulation | 1st Semester 2025 Regulation