import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.*;public class sqrtNum { public static void main(String args[]) {
int n;
String n1 = " ";//定义一个String整型对象n1 
BufferedReader distream = new BufferedReader(new InputStreamReader(
System.in));
System.out.println("键入一个三位整数 ");//输入数字为负数或者小于121的数时,如何写出提示信息呢??????? try {
n1 = distream.readLine();
} catch (IOException e) { e.printStackTrace();
}//进行输入,并把输入的数存入nn1中
n = Integer.parseInt(n1); Find(n);
} static void Find(double n) { for (int i = 11; i <= Math.sqrt(n); i++) {
for (int j = 121; j <= n; j++) {
if (i * i == j) {
if (j % 10 == j / 100 || j % 10 == j / 10 % 10
|| j / 100 == j / 10 % 10) {
System.out.print("The just number is " + j + "---");
System.out.println("The corresponding sqrt number is "
+ i);
} } } } }
}

解决方案 »

  1.   

    [code = java]
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.lang.*;public class sqrtNum { public static void main(String args[]) {
    int n;
    String n1 = " ";//定义一个String整型对象n1 
    BufferedReader distream = new BufferedReader(new InputStreamReader(
    System.in));
    System.out.println("键入一个三位整数 ");//输入数字为负数或者小于121的数时,如何写出提示信息呢??????? try {
    n1 = distream.readLine();
    } catch (IOException e) { e.printStackTrace();
    }//进行输入,并把输入的数存入nn1中
    n = Integer.parseInt(n1); Find(n);
    } static void Find(double n) { for (int i = 11; i <= Math.sqrt(n); i++) {
    for (int j = 121; j <= n; j++) {
    if (i * i == j) {
    if (j % 10 == j / 100 || j % 10 == j / 10 % 10
    || j / 100 == j / 10 % 10) {
    System.out.print("The just number is " + j + "---");
    System.out.println("The corresponding sqrt number is "
    + i);
    } } } } }
    }
    [/code]
      

  2.   

    【code=Java】
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.lang.*;public class sqrtNum { public static void main(String args[]) {
    int n;
    String n1 = " ";//定义一个String整型对象n1 
    BufferedReader distream = new BufferedReader(new InputStreamReader(
    System.in));
    System.out.println("键入一个三位整数 ");//输入数字为负数或者小于121的数时,如何写出提示信息呢???????
    try {
    n1 = distream.readLine();
    } catch (IOException e) { e.printStackTrace();
    }//进行输入,并把输入的数存入nn1中
    n = Integer.parseInt(n1); Find(n);
    } static void Find(double n) { for (int i = 11; i <= Math.sqrt(n); i++) {
    for (int j = 121; j <= n; j++) {
    if (i * i == j) {
    if (j % 10 == j / 100 || j % 10 == j / 10 % 10
    || j / 100 == j / 10 % 10) {
    System.out.print("The just number is " + j + "---");
    System.out.println("The corresponding sqrt number is "
    + i);
    } } } } }
    }
    【/code】
      

  3.   


    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.lang.*;public class sqrtNum { public static void main(String args[]) {
    int n;
    String n1 = " ";//定义一个String整型对象n1 
    BufferedReader distream = new BufferedReader(new InputStreamReader(
    System.in));
    System.out.println("键入一个三位整数 ");//输入数字为负数或者小于121的数时,如何写出提示信息呢???????
    try {
    n1 = distream.readLine();
    } catch (IOException e) { e.printStackTrace();
    }//进行输入,并把输入的数存入nn1中
    n = Integer.parseInt(n1); Find(n);
    } static void Find(double n) { for (int i = 11; i <= Math.sqrt(n); i++) {
    for (int j = 121; j <= n; j++) {
    if (i * i == j) {
    if (j % 10 == j / 100 || j % 10 == j / 10 % 10
    || j / 100 == j / 10 % 10) {
    System.out.print("The just number is " + j + "---");
    System.out.println("The corresponding sqrt number is "
    + i);
    } } } } }
    }
      

  4.   

    System.out.println("键入一个三位整数 ");//输入数字为负数或者小于121的数时,如何写出提示信息呢???????
            try {
                n1 = distream.readLine();
            } catch (IOException e) {=====================
    try{
        n1 = distream.readLine();
      if(Integer.ParseInt(n1)<121){
        system.out.println("您输入的数小于121,请重新输入");
    }
    } catch (IOException e) {