24.12.19

Palindrome of string program in c

#include<stdio.h>
#include<conio.h>
#include<string.h>

void main()
{
char str1[30],str2[30];
int n;
clrscr();
printf("Enter a string");
gets(str1);
strcpy(str2,str2);
strrev(str1);
n=strcmp(str,str);
if(n==0)
printf("\n The given string is palindrome");
else
printf("\n The given string is not a palindrome");
getch();
}


OUTPUT:

Enter a string mom

The given string is palindrome

Enter a string mad

The given string is not a palindrome

No comments:

Post a Comment

JAVA program pattern 2

import java.util.Scanner; public class pattern3 { public static void main(String args[]) { int i,j; Scanner sc=new Scanner(System.in); Syste...