Holek

Untitled

Feb 9th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int fun(char *napis)
  6. {
  7.  
  8. char * wynik = (char*)malloc(sizeof(char)*255);
  9. int i,licznik=0;
  10. wynik=napis;
  11. for(i=0; wynik[i]!='\0'; i++){
  12. if(wynik[i]>='A' && wynik[i]<='Z'){
  13. wynik[i]=wynik[i]^32;
  14.  
  15. }
  16. }
  17.  
  18. for(i=0;wynik[i+1]!='\0';i++)
  19. if(wynik[i]==wynik[i+1])
  20. licznik++;
  21.  
  22. return licznik;
  23. }
  24.  
  25. int main()
  26. {
  27. int i;
  28. printf("%d",fun("aaaa"));
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment