프로그래머스 181947번 덧셈식 출력하기 - Python, Java
문제 설명
두 정수 a, b가 주어질 때 다음과 같은 형태의 계산식을 출력하는 코드를 작성해 보세요.
a + b = c
제한 사항
- 1 ≤
a,b≤ 100
입출력 예시
예시 1
입력 1
4 5
출력 1
4 + 5 = 9
코드 구현
Python
a, b = map(int, input().strip().split(' '))
print(f"{a} + {b} = {a + b}")
Java
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println(a + " + " + b + " = " + (a + b));
}
}