feat(strings): ex5
This commit is contained in:
20
strings/ex5.c
Normal file
20
strings/ex5.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void) {
|
||||
|
||||
char word[100];
|
||||
|
||||
printf("Digite a palavra: ");
|
||||
fgets(word, 100, stdin);
|
||||
|
||||
word[strcspn(word, "\n")] = '\0';
|
||||
|
||||
for (int i = strlen(word) - 1; i >= 0; i--) {
|
||||
printf("%c", word[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user