SHARE
TWEET

Untitled

a guest Feb 21st, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. void main()
  5. {
  6.     char string[25];
  7.     char string2[25]={'\0'}; //strings initialised
  8.     int a=0;
  9.     int b=0;
  10.     int c=0;
  11.  
  12.     printf("Enter a word to check if it is a pallendrome. \n");
  13.     gets_s(string);
  14.  
  15.     for(a=0;string[a]!='\0'; a++)
  16.     {
  17.    
  18.     }
  19.     c=a-1;
  20.  
  21.     for(b=0;b<a;b++)
  22.     {
  23.         string2[b]=string[c];
  24.         c--;
  25.     }
  26.    
  27.     if(strcmp(string,string2)==0)
  28.     printf("%s is a pallendrome.\n", string);
  29.    
  30.     else
  31.     printf("%s is not a pallendrome.\n", string);
  32.  
  33.     system("pause");
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top