Guest User

Untitled

a guest
Oct 23rd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void invert(char sentence[]) {
  5.  
  6. int sentenceLenght = strlen(setning);
  7. char sentenceInverted[setningLenght];
  8.  
  9. for(int i = 0; i < sentenceLenght; i++)
  10. {
  11.  
  12. for(int j = sentenceLenght; j > 0; j--)
  13. {
  14.  
  15. sentenceInverted[i] = sentence[j];
  16.  
  17. }
  18.  
  19. }
  20.  
  21. printf("n%s", sentenceInverted);
  22.  
  23. }
  24.  
  25.  
  26. int main()
  27. {
  28.  
  29. char sentence[100];
  30. printf("Write in a sentence: ");
  31. scanf("%s", sentence);
  32.  
  33. invert(sentence);
  34.  
  35. }
Add Comment
Please, Sign In to add comment