inblog logo
|
jay0628
    programmers Java

    [Java] 6. 덧셈식 출력하기

    김주희's avatar
    김주희
    May 07, 2025
    [Java] 6. 덧셈식 출력하기
    Contents
    1. 문제 설명, 제한 사항, 입출력 예시2. 아이디어3. 풀이 코드
    school.programmers.co.kr
    https://school.programmers.co.kr/learn/courses/30/lessons/181947

    1. 문제 설명, 제한 사항, 입출력 예시

    notion image
     

    2. 아이디어

    💡
    System.out.println() 메서드 내부에서 + 기호가 문자열 연결 연산자로 사용되며, 문자열과 int를 하나의 문자열로 만들 수 있다.
     

    3. 풀이 코드

    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)); } }
    Share article

    jay0628

    RSS·Powered by Inblog