fork(1) download
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. int main() {
  4. char name[50];
  5. printf("Tell me a word: \n");
  6. scanf("%s", name);
  7. int i;
  8. for (i = 0; name[i] != '\0'; i++);
  9. if (name[i] == '\0') {
  10. printf("The number of letters is %d\n", i);
  11. }
  12. printf("The word is the reverse order is\n");
  13. for (int j = i; j >= 0; j--) {
  14. printf("%c", name[j]);
  15. }
  16. }
Success #stdin #stdout 0s 2172KB
stdin
teste
stdout
Tell me a word: 
The number of letters is 5
The word is the reverse order is
etset