soluces/c/semaine-4/own-rot-convertor/main.c
2023-11-22 23:07:21 +01:00

22 lines
399 B
C

#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#define ROT 13
int main(void) {
char text[] = "bonjour agentty, ras de notre cote egalement. over", base;
int i;
for (i = 0; text[i] != '\0'; ++i) {
if (isalpha(text[i])) {
base = islower(text[i]) ? 'a' : 'A';
text[i] = (text[i] - base + ROT) % 26 + base;
}
}
printf("%s", text);
return EXIT_SUCCESS;
}