LOVEGUN

Discovering C language

Oct 3rd, 2021 (edited)
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 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.     do
  10.     {
  11.         printf ("Donner le premier mot\n");
  12.         scanf ("%s",ch);
  13.         printf ("Donner le deuxieme mot\n");
  14.         scanf ("%s",ch1);
  15.         test=strlen(ch)==strlen(ch1);
  16.     }while (test!=1);
  17.     i=0;
  18.     do
  19.     {
  20.         test=ch[i]==ch1[(strlen(ch)-1)-i];
  21.         i++;
  22.     }while (test==1 && i<strlen(ch));
  23.     if (test==1)
  24.     {
  25.         printf ("Les deux mots sont inverses");
  26.     }
  27.     return 0;
  28. }
  29.  
  30.  
Add Comment
Please, Sign In to add comment