Programming Study/Python
[CodeUp-python] 기초 100제 #6032
myejinni
2023. 1. 27. 16:11
코드
# 입력된 정수의 부호를 바꿔 출력
n=int(input())
print(-n)
실행 결과
참고
단항(unary) 연산자인 -(negative)를 변수 앞에 붙이면 부호가 반대인 값이 됨