Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ejercicio1Completo;
- import java.util.Scanner;
- public class terminado{
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- String eje = "";
- Scanner valor=new Scanner (System.in);
- try {
- System.out.println("Ingrese el valor de X");
- int X = valor.nextInt();
- System.out.println("Ingrese el valor de Y");
- int Y = valor.nextInt();
- if (X>0 && Y>0) {
- System.out.println("el punto pertenece al primer cuadrante I");
- } else
- if (X<0 && Y>0) {
- System.out.println("el punto pertenece al segundo cuadrante II");
- }else
- if (X<0 && Y>0) {
- System.out.println("el punto pertenece al tercer cuadrante III");
- }else
- if (X>0 && Y<0) {
- System.out.println("el punto pertenece al cuarto cuadrante IV");
- }else
- if (X==0 && Y==0) {
- System.out.println("el punto pertenece al origen de coordenadas");
- }else
- if (Y!=0) {
- if (Y>0) {
- eje=" Y positivo";
- } else
- eje=" Y negativo";
- }
- if (X!=0) {
- if (X>0) {
- eje=" X positivo";
- } else
- { eje=" X negativo";
- }
- }
- System.out.println ("El punto (" + X + "," + Y + ") pertenece al eje"+ eje);
- } catch (Exception e) {
- System.out.println("se produjo un error INGRESE CORRECTAMENTE LOS VALORES");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement