From 8d784e46d6e2fda18cfd1573f47c406173a297b7 Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L de Mello" Date: Mon, 30 Mar 2026 16:26:00 -0300 Subject: [PATCH] feat(strings): ex5 --- strings/ex5.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 strings/ex5.c diff --git a/strings/ex5.c b/strings/ex5.c new file mode 100644 index 0000000..9964053 --- /dev/null +++ b/strings/ex5.c @@ -0,0 +1,20 @@ +#include +#include +#include + +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; +}