[๋ฐฑ์ค€/java] 2588๋ฒˆ : ๊ณฑ์…ˆ

2021. 2. 10. 17:19

๋ฌธ์ œ

(์„ธ ์ž๋ฆฌ ์ˆ˜) × (์„ธ ์ž๋ฆฌ ์ˆ˜)๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ณผ์ •์„ ํ†ตํ•˜์—ฌ ์ด๋ฃจ์–ด์ง„๋‹ค.

(1)๊ณผ (2)์œ„์น˜์— ๋“ค์–ด๊ฐˆ ์„ธ ์ž๋ฆฌ ์ž์—ฐ์ˆ˜๊ฐ€ ์ฃผ์–ด์งˆ ๋•Œ (3), (4), (5), (6)์œ„์น˜์— ๋“ค์–ด๊ฐˆ ๊ฐ’์„ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

 

์ž…๋ ฅ

์ฒซ์งธ ์ค„์— (1)์˜ ์œ„์น˜์— ๋“ค์–ด๊ฐˆ ์„ธ ์ž๋ฆฌ ์ž์—ฐ์ˆ˜๊ฐ€, ๋‘˜์งธ ์ค„์— (2)์˜ ์œ„์น˜์— ๋“ค์–ด๊ฐˆ ์„ธ์ž๋ฆฌ ์ž์—ฐ์ˆ˜๊ฐ€ ์ฃผ์–ด์ง„๋‹ค.

 

์ถœ๋ ฅ

์ฒซ์งธ ์ค„๋ถ€ํ„ฐ ๋„ท์งธ ์ค„๊นŒ์ง€ ์ฐจ๋ก€๋Œ€๋กœ (3), (4), (5), (6)์— ๋“ค์–ด๊ฐˆ ๊ฐ’์„ ์ถœ๋ ฅํ•œ๋‹ค.

 

์ •๋‹ต

import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int a = s.nextInt();
        int b = s.nextInt();
        
        System.out.println(a * (b%10));
        System.out.println(a * (b/10%10));
        System.out.println(a * (b/100));
        System.out.println(a * b);
    }
}
728x90

BELATED ARTICLES

more