Kali ini saya akan membagikan tentang poin di segitiga, . .
Langsung saja di coba, . .
import java.util.Scanner;
public class PointsInTriangle {
public static void main(String[] iriahus) {
@SuppressWarnings("resource")
Scanner s = new Scanner(System.in);
System.out.print("Enter a point's x- and y-coordinate: ");
double x = s.nextDouble();
double y = s.nextDouble();
double a = y + 0.5 * x - 100;
if (x < 0 || y < 0 || a > 0) {
System.out.println("The point is not in the triangle");
} else {
System.out.println("The point is in the triangle");
}
}
}
Semoga bermanfaat, . .
0 Response to "Poin Di Segitiga"
Post a Comment