C

Monday, 26 June 2017

Program showing Whether given String Is Palindrome Or Not

#include<stdio.h>
#include<string.h>
main()
{
          char  s1[20],s2[20];
          clrscr();
          printf("Enter a string");
          gets(s1);
          strcpy(s2,s1);
          strrev(s2);
          if((strcmp(s1,s2))==0)
                   printf("String is a palindrome");
          else
                   printf("String is not a palindrome");

}

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) {         ...