C

Tuesday, 5 September 2017

Program To Check Whether A Given String Is Palindrome Or Not.

#include<stdio.h>
#include<string.h>
main()
{
char strng[30];
int i,lngth,flag=0;
printf("Enter a string : ");
scanf("%s",&strng);
lngth=strlen(strng);
for(i=0;i<lngth;i++)
{
if(strng[i]!=strng[lngth-i-1])
{
flag=1;
break;
}
}
if(flag)
printf("%s is not a palindrome");
else
printf("%s is a palindrome");
returm 0;
}


No comments:

Post a Comment

Write a program to draw a circle using mid-point circle drawing algorithm.

#include<iostream.h> #include<graphics.h> #include<conio.h> void drawcircle(int x0, int y0, int r) {         ...