
1. A+B 출력하기
A, B = map(int,input().split())
print(A+B)
2. A-B 출력하기
A, B = map(int,input().split())
print(A-B)
3. A*B 출력하기
A, B = map(int,input().split())
print(A*B)
4. A/B 출력하기
A, B = map(int,input().split())
print(A/B)
사칙연산 출력하기
다만, 주의할 점이 파이썬은 나눗셈을 할 때
A/B 라면 실수의 몫을 출력하기 때문에 A//B를 사용해야 한다.
조건: 1<= A, B <=10000
A, B = map(int, input().split())
if A>=1 and A<=10000 and B>=1 and B<=10000:
print(A+B)
print(A-B)
print(A*B)
print(A//B)
print(A%B)
'언어 > Python' 카테고리의 다른 글
| [python] 파이썬 응용 해보기 - 영화관 좌석 예약 (에티버스러닝 - 멀티 클라우드 엔지니어 교육) (1) | 2023.05.22 |
|---|---|
| [python] 파이썬 응용 - 등수 비교 (에티버스러닝 - 멀티 클라우드 엔지니어 교육 5주차) (0) | 2023.05.19 |
| [python] 헷갈리는 개념 (에티버스러닝 - 멀티 클라우드 엔지니어 교육 5주차) (0) | 2023.05.18 |
| [python] 파이썬 if문 응용 - 생년월일을 입력 받아서 만 나이 출력하기 (0) | 2023.05.18 |
| [python] List 기본 (index 활용, 메소드, 함수) (0) | 2023.05.17 |