Advertisement
Josif_tepe

Untitled

Dec 23rd, 2020
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include<stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int proverka_iterativna(char *s) {
  6.     int S = 0;
  7.     int E = strlen(s) - 1;
  8.     while(S <= E) {
  9.         if(*(s + S) != *(s + E)) {
  10.             return 0;
  11.         }
  12.         S += 1;
  13.         E -= 1;
  14.     }
  15.     return 1;
  16. }
  17. //abca
  18. //S  E
  19.  
  20. int main(){
  21.     char s[101];
  22.     scanf("%s", s);
  23.    
  24.     if(proverka_iterativna(<#char *s#>)(s) == 1) {
  25.         printf("PALINDROM\n");
  26.     }
  27.     else {
  28.         printf("NE E PALINDROM\n");
  29.     }
  30.     return 0;
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement