배열 - 배열 수행평가10(문자교환하기)

2018. 7. 8. 11:42algorithm/dimigo.goorm.io

#include <stdio.h>

#include <string.h>


int main() {

char a[100];

char b[100];

int i;

int num = 0;

int len;

char tmp;

scanf("%s", a, 30);

len = strlen(a);

tmp = a[len - 1];

a[len - 1] = a[0];

a[0] = tmp;

for (i = 0; i < len; i++) {

printf("%c", a[i]);

}

}