냠냠냠

java) 두 자리수 덧셈 합 99 만족하는 수 조합 찾기 본문

언어/JAVA

java) 두 자리수 덧셈 합 99 만족하는 수 조합 찾기

[Nada] 2019. 11. 29. 15:50

  A B

+B A

-------  조건 만족하는 수 조합 찾기 / for 문 사용

  9 9 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
public class ContinueBreak {
 
    public static void main(String[] args) {
        for(int i=1; i<10; i++) {
            for(int j=1; j<10; j++) {
                if((i*10 + j) + (j*10 + i) == 99) {
                    System.out.println("   "++ j);
                    System.out.println(" + "++ i);
                    System.out.println("---------");
                    System.out.println("   "+ ((i*10 +j) + (j*10 +i)));
                    System.out.println();
                }
            }
        }
    }
 
}
 
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

 

 

Comments