Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7. int r = funkce();
  8. }
  9.  
  10. int funkce (){
  11. {
  12. char s[] = {"abcabcabc"};
  13. char a;
  14. printf("Zadej znak:\n");
  15. scanf("%s", &a);
  16. printf("Zadej vyskyt:\n");
  17. int vyskyt;
  18. scanf("%i", &vyskyt);
  19. for (int i = 0; i < (sizeof(s) / sizeof(char));i++)
  20. {
  21. if (s[i] == a){
  22. vyskyt = vyskyt - 1;
  23. if (vyskyt == 0)
  24. {
  25. printf("%i", i);
  26. return 0;
  27. }
  28. }
  29. }
  30. printf ("neexistuje");
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement