提示用户输入一个点(x, y),检查这个点是否在以原点(0, 0)为圆心,半径为10的圆内。
import java.util.*;
public class circle {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter a point with two coordinates: ");
double x = input.nextDouble();
double y = input.nextDouble();
double lenth = Math.sqrt(x * x + y * y);
if(lenth > 10) {
System.out.printf("Point (%.1f, %.1f) is not in the circle",x,y);
}
else
System.out.printf("Point (%.1f, %.1f) is in the circle",x,y);
}
}