Advertisement
kokusz19

Szam utolso X szama egyezik e

May 28th, 2017
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4. #include <stdlib.h>
  5.  
  6. char sor[200];
  7. int main()
  8. {
  9. int szam, i, j, egyezik=0;
  10.  
  11. while(scanf("%d ", &szam) && gets(sor) != NULL)
  12. {
  13.  
  14. for(i=0;i<szam;i++)
  15. {
  16.  
  17. if(sor[i]==sor[strlen(sor)-szam+i])
  18. {
  19. egyezik++;
  20. }
  21. }
  22. if(egyezik==szam)
  23. printf("GOOD\n");
  24. else
  25. printf("BAD\n");
  26. egyezik=0;
  27. }
  28.  
  29. return EXIT_SUCCESS;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement