BOJ 11654. 아스키 코드 (C, Python)
2021. 2. 6. 23:55ㆍProblem Solving/BOJ
BOJ 11654. 아스키 코드
https://www.acmicpc.net/problem/11654
11654번: 아스키 코드
알파벳 소문자, 대문자, 숫자 0-9중 하나가 주어졌을 때, 주어진 글자의 아스키 코드값을 출력하는 프로그램을 작성하시오.
www.acmicpc.net
파이썬 아스키코드?
생각해보니까 파이썬에서 아스키코드로 어떻게 출력해주는지 모른다!
그래서 찾아서 정리 해 보았다 :)
https://developeryuseon.tistory.com/86
[Python] 파이썬에서 아스키코드 변환 (chr(), ord())
문자 -> 아스키코드 : chr() 아스키코드 -> 문자 : ord() chr() print(chr(65)) print(chr(122)) """ A z """ ord() print(ord('A')) print(ord('z')) """ 65 122 """ 아스키(ASCII) 코드 표
developeryuseon.tistory.com
Solution
C
#include <stdio.h>
int main(){
char n;
scanf("%c",&n);
printf("%d",n);
return 0;
}
Python
print(ord(input()))
반응형
'Problem Solving > BOJ' 카테고리의 다른 글
BOJ 10818. 숫자의 합(Python) (0) | 2021.02.07 |
---|---|
BOJ 11729. 숫자의 합(Python) (0) | 2021.02.07 |
BOJ 8958. OX퀴즈 (Python) (0) | 2021.02.05 |
BOJ 2920. 음계 (Python) (0) | 2021.02.05 |
BOJ 2639. 구구단 (Python) (0) | 2021.02.05 |