java↗4-4. 사칙 연산자, 산술변환
사칙 연산자 public class PrintfEx2 { public static void main(String[] args) { int a = 10; int b = 4; System.out.printf("%d + %d = %d%n", a, b, a+b); System.out.printf("%d - %d = %d%n", a, b, a-b); System.out.printf("%d * %d = %d%n", a, b, a*b); System.out.printf("%d / %d = %d%n", a, b, a/b); System.out.printf("%d / %f = %f%n", a, (float)b, a / (float)b); // int i를 f float으로 변환하니까 i가 f보다 범위가 작으므로 (flo..
2024.03.14