๋ฐ์ํ
import java.util.Scanner;
public class Main {
// 10 2588 ๊ณฑ์
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int firstInput = scanner.nextInt();
int secondInput = scanner.nextInt();
scanner.close();
System.out.printf("%d\n", firstInput * (secondInput % 10));
System.out.printf("%d\n", firstInput * ((secondInput % 100) / 10));
System.out.printf("%d\n", firstInput * (secondInput / 100));
System.out.printf("%d", firstInput * secondInput);
}
}
- ๋๋ฒ์งธ๋ก ์ ๋ ฅ๋ ๊ฐ๋ง ์ ๋๋์ด firstInput๊ฐ๊ณผ ๊ณฑํ๋ฉด ๋ฉ๋๋ค.
- 385๋ฅผ 10์ผ๋ก ๋๋๋ฉด ํ์๋ฆฌ์ธ 5๋ง ๋จ์ต๋๋ค.
- 385๋ฅผ 100์ผ๋ก ๋๋๋ฉด 85๊ฐ ๋จ๋๋ฐ,
๋ค์ / 10 ๋๋๋ฉด integerํ์ ์ 10์ง์๋ง ํ๊ธฐํ๋ ํน์ฑ์ ์์์ ์ ์ฌ๋ผ์ง๊ธฐ์ 8๋ง ๋จ์ต๋๋ค. - 385๋ฅผ 100์ผ๋ก ๋๋๋ฉด 3.85๊ฐ ๋ง์ฐฌ๊ฐ์ง๋ก Integerํ์ ์ผ๋ก๋ 3๋ง ๋จ๊ฒ๋ฉ๋๋ค.
๋ฐ์ํ
'๐ธ Algorithm > ๐ธ ๋ฐฑ์ค BaekJoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค][java][10171][๊ณ ์์ด] (0) | 2023.09.10 |
---|---|
[๋ฐฑ์ค][java][11382][๊ผฌ๋ง ์ ๋ฏผ] (0) | 2023.09.10 |
[๋ฐฑ์ค][java][10430][๋๋จธ์ง] (0) | 2023.08.27 |
[๋ฐฑ์ค][java][18108][1998๋ ์์ธ ๋ด๊ฐ ํ๊ตญ์์๋ 2541๋ ์?!] (0) | 2023.08.27 |
[๋ฐฑ์ค][java][10869][์ฌ์น์ฐ์ฐ] (0) | 2023.08.27 |