티스토리 뷰

틀린 코드

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package practice;
 
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
 
        Scanner sc = new Scanner(System.in);
        
        int A = 0;
        int B = 0;
        
        System.out.print("A와 B 값을 차례대로 입력하세요");
        A = sc.nextInt();
        B = sc.nextInt();
        
        System.out.println(A+B);
    }
}

 

수정 후 정답 코드

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package practice;
 
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
 
        Scanner sc = new Scanner(System.in);
        
        int A = 0;
        int B = 0;
        
        A = sc.nextInt();
        B = sc.nextInt();
        
        System.out.println(A+B);
    }
}
 

" System.out.print("A와 B 값을 차례대로 입력하세요");" 이거 한 줄 때문에 틀렸당....따흐흑

괜히 문제에 없는 코드 덧붙이지 말자~~~

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함