Thursday, June 1, 2017

Palindromic String using function

 This is C program for Palindrome number which is check whether number or string is palindrome or not. Palindrome means given number which is same as reverse number.

eg. 12321==12321    Palindrome number
      nitin==nitin         Palindrome string
      12345==54321   Not palindrome number
      cool==looc          Not palindrome string

This palindrome program is created without string header file or string function.

Program for palindrome:-


#include <stdio.h>
#include <string.h>
int main()
{
    int i,a;
    char s[100],b[100];
    scanf("%s",&s);
    a=strlen(s);
    for(i=0;i<a;i++)
    {
        b[i]=s[a-i];
    }
    printf("%s",b);
    if(strcmp(s,b))
    printf("YES it is palindrom string");
    else
    printf("NOT palindrome string");
    return 0;
}

Output:

                    abcba

                    abcba
Yes it is palindrome string


Please comment and give Suggestion on this post, if you want any other program or help then type in comment or contact me, and give feedback for this blogs.

No comments:

Post a Comment

Acer Nitro 5 Ryzen 7 4800H - Blender Open Data Benchmark | Blender BMW Benchmark

Hello friends in this video I have perform benchmark of Acer Nitro 5 Ryzen 7 4800H laptop using Blender Open data Benchmark tool. In this to...