关于下题的代码要怎么填写
求解答
求解答
2017-03-26
package com.myjava;
public class helloworld
{
public static void main (String args[])
{
helloworld hello=new helloworld();
for (int i=10;i<=30;i++)
hello.fun(i);
}
public void fun(int num)
{
if(num%2==1)
for(int i=1;i<=num;i++)
if(Math.pow((int)Math.sqrt(i), 2)==i&&Math.pow((int)Math.sqrt(num-i), 2)==num-i)
{
System.out.println(num+"="+i+"+"+(num-i));
return;
}
}
}
举报