BASIC의 개발 노트
1295 : 알파벳 대소문자 변환 본문
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <stdio.h> int main(void) { // A: 65, Z: 90, a:97, z: 122 int i; char strData[1000] = {0}; // 입력에 공백이 없다면 scanf를 사용할 수 있다. // 만약 입력에 공백이 있을 경우 gets_s, fgets 등을 사용해야한다. scanf("%s", strData); for(i = 0; strData[i] != '\0'; i++) { if (strData[i] <= 90 && strData[i] >= 65) printf("%c", strData[i] + 32); else if(strData[i] >= 97 && strData[i] <= 122) printf("%c", strData[i] - 32); else printf("%c", strData[i]); } return 0; } | cs |
'Algorithm > CodeUp' 카테고리의 다른 글
| 1294 : 씨저의 암호 2 (0) | 2020.04.14 |
|---|---|
| 1675 : 씨저의 암호 1 (0) | 2020.04.14 |
| 1287 : 구구단을 *로 출력하기 (0) | 2020.04.14 |
| 1286 : 최댓값, 최솟값 (0) | 2020.04.14 |
| 1285 : 계산기 2 (0) | 2020.04.14 |
Comments