You are viewing a single comment's thread. Return to all comments →
New to coding, this is how i did it in C, it works, but could i have done it a bit cleaner? Coulnd find any C examples. :/
#include <stdio.h> int main() { int i; int N; char str[10000]; scanf("%d", &N); while (N > 0) { scanf("%s", str); i = 0; while (str[i] != '\0') { if ((i%2) == 0) printf("%c", (str[i])); i++; } putchar (' '); i = 0; while (str[i] != '\0') { if ((i%2) == 1) printf("%c", str[i]); i++; } putchar('\n'); N--; } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 6: Let's Review
You are viewing a single comment's thread. Return to all comments →
New to coding, this is how i did it in C, it works, but could i have done it a bit cleaner? Coulnd find any C examples. :/