fork(1) download
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main() {
  5. char str[50];
  6. printf(" We will count the number of letters\n");
  7. printf("-------------------------------------\n");
  8. printf("Tell me the word: \n");
  9. scanf("%s", str);
  10. int i;
  11. for (i= 0; str[i] != '\0'; i++) printf("The letter %d is %c\n", i, str[i]);
  12. printf("|The number of words is: %d\n", i);
  13. }
  14.  
  15. //https://pt.stackoverflow.com/q/172952/101
Success #stdin #stdout 0s 4316KB
stdin
teste
stdout
 We will count the number of letters
-------------------------------------
Tell me the word: 
The letter 0 is t
The letter 1 is e
The letter 2 is s
The letter 3 is t
The letter 4 is e
|The number of words is: 5