public class Main {
public static void main(String[] args) {
double[] nums = {10.1, 11.2, 12.3, 13.4, 14.5};
double result = 0;
int i;
for(i=0; i<5; i++)
result = result + nums[i];
System.out.println( result );
}
}
public static void main(String[] args) {
double[] nums = {10.1, 11.2, 12.3, 13.4, 14.5};
double result = 0;
int i;
for(i=0; i<5; i++)
result = result + nums[i];
System.out.println( result );
}
}
이거 결과값이 왜 61.49999999999999가 출력되는거노?
부동 소수점
그럼 61.5 나오게 하려면 어떻게 해야되노묵훈?
bigdecimal 사용
ㅅㅂ색기들 언어를 왜일 좇같이 만들어놨냐