Advertisement
LOVEGUN

Discovering C language (Palindrome)

Oct 3rd, 2021
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     char ch[50];
  7.     char ch1[50];
  8.     int test,i;
  9.     printf ("Donner votre mot: ");
  10.     scanf ("%s",ch);
  11.     do
  12.     {
  13.         test=ch[i]==ch[(strlen(ch)-1)-i];
  14.         i++;
  15.     }while (test==1 && i<strlen(ch));
  16.     if (test==1)
  17.     {
  18.         printf ("\nLe mot est palindrome");
  19.     }
  20.     return 0;
  21. }
  22.  
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement