public class IntegerDemo {
public static void main(String[] args) {
int number1 = 10;
int number2 = 5;
// TODO: Perform arithmetic operations and print the results
}
}
public class FloatDemo {
public static void main(String[] args) {
// TODO: Declare and use floating-point numbers
}
}
TODO コメントを浮動小数点数の使用を示すコードに置き換えましょう。
double pi = 3.14159;
System.out.println("The value of pi is approximately: " + pi);
double radius = 5.0;
double area = pi * radius * radius;
System.out.println("The radius of the circle is: " + radius);
System.out.println("The area of the circle is: " + area);
// Demonstrating precision
double result = 0.1 + 0.2;
System.out.println("0.1 + 0.2 = " + result);