2019-10-02 in class

This commit is contained in:
Claudio Maggioni 2019-10-02 08:42:16 +02:00
parent 6b4caa8223
commit 89ac20cdf0

19
flipword.c Normal file
View file

@ -0,0 +1,19 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LINE_SIZE 1000
int main() {
char line[LINE_SIZE];
while(!feof(stdin)) {
fgets(line, LINE_SIZE, stdin);
size_t i = strlen(line) - 1;
if (line[--i] != '\n') {
putchar(line[i--]);
}
for (; i > 0; i--)
putchar(line[i]);
putchar(line[0]);
putchar('\n');
}
}