Skip to content

Instantly share code, notes, and snippets.

@Sergaav
Created March 26, 2015 13:43
Show Gist options
  • Save Sergaav/f49961c44b73ef3c4dc8 to your computer and use it in GitHub Desktop.
Save Sergaav/f49961c44b73ef3c4dc8 to your computer and use it in GitHub Desktop.
circle and point(x,y)
package com.gmail.sergaav.dz3_2;
import java.util.Scanner;
public class dz3_2 {
public static void main(String[] args) {
double x;
double y;
double r=4.0;
Scanner sc = new Scanner (System.in);
System.out.println("Input x:");
x=sc.nextDouble();
System.out.println("Input y:");
y = sc.nextDouble();
System.out.println((Math.sqrt(Math.pow(x,2)+Math.pow(y, 2))<=r) ? "YES":"NO" );
sc.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment