Facebook
From Magda, 7 Years ago, written in C.
Embed
Download Paste or View Raw
Hits: 270
  1. #include <stdio.h>
  2. #include <string.h>
  3. #define g 255
  4.  
  5.  
  6. int main()
  7. {
  8.         char slowo[g],slowo2[g];
  9.         int x,i,n,l;
  10.        
  11.         printf("Wprowadz slowo ");
  12.         scanf("%s",&slowo);
  13.         printf("\n Wprowadzone slowo: %s \n",slowo);
  14.         x=strlen(slowo);
  15.         printf("wprowadzone slowo ma %d znakow",x);
  16.        
  17.         i=0;
  18.         n=x-1;
  19.         for(i;i<x;i++)
  20.         {
  21.                 slowo2[i]=slowo[n];
  22.                 n--;
  23.         }
  24.        
  25.         printf("\n Wprowadzone slowo wpisane od tylu: %s \n",slowo2);
  26.        
  27.         l= strcmp(slowo,slowo2);
  28.         if(l!=0)
  29.          printf("\n Wprowadzone slowo nie jest palindromem \n");
  30.                 else
  31.          printf("\n Wprowadzone slowo jest palindromem \n");
  32.  
  33.                
  34.        
  35.        
  36.        
  37.        
  38.        
  39.         return 0;
  40. }