small steps/1일 1코딩 - 코딩을 내 몸처럼

[1일1코딩][코딩테스트] 백준 단계별 문제풀이 1-3,4번

꿈꾸는개발자maker 2022. 9. 4. 17:59
728x90

 

백준 단계별 풀이

3,4번

사용언어 : 자바

스캐너 사용

 

 

    // Step1-3 A+B
    public void method01(){

        int a=0;
        int b=0;
        Scanner sc = new Scanner(System.in);
        a=sc.nextInt();
        b=sc.nextInt();
        System.out.println(a+b);
    }

    // Step1-4 1001번 A-B
    public void method02(){
        // import java.util.*;
        int a = 0;
        int b = 0;

        Scanner sc = new Scanner(System.in);
        a = sc.nextInt();
        b = sc.nextInt();

        System.out.println(a-b);

    }
728x90
반응형