[Java] Baekjun No. 1008 - A/B
Characteristics of Java integer division, and explicit casting techniques for accurate floating-point results
한국어 원문은 여기에서 볼 수 있습니다.
[Java] Baekjun No. 1008 - A/B
Solution
1
2
3
4
5
6
7
8
9
10
11
12
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
int num1 = input.nextInt();
int num2 = input.nextInt();
System.out.print((double)num1 / num2);
}
}
/ division operation in Java
정수 / 정수: The result isint, i.e. returns only the quotient.- To return the entire division result, including real numbers, type conversion must be done using either
doubleorfloat.