Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. char word[100];
  5. printf("Insert word: ");
  6. scanf("%s", word);
  7. printf("The word is %s \n", word);
  8.  
  9. char *p;
  10. int count = 0;
  11. int xCount = 0;
  12. for(p = word; *p; p++) {
  13. count++;
  14. if(*p == 'x') {
  15. xCount++;
  16. }
  17. }
  18.  
  19. printf("You have %d letter in the word and x appears %d times", count, xCount);
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement