inblog logo
|
harimmon
    자바

    [Java] 6. 더하기 연산자

    백하림's avatar
    백하림
    Feb 04, 2025
    [Java] 6. 더하기 연산자
    package ex02; import java.util.Scanner; public class Add2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // 키보드 입력 받기 // 변수의 선언 null 값이 들어감 // int를 선언하면 0이 들어감. int x; int y; int sum; System.out.println("첫 번째 숫자를 입력하시오 : "); x = sc.nextInt(); System.out.println("두 번째 숫자를 입력하시오 : "); y = sc.nextInt(); sum = x + y; System.out.println("두 수의 합은 : " + sum + " 입니다."); } }
    notion image
    Share article

    harimmon

    RSS·Powered by Inblog