You are viewing a single comment's thread. Return to all comments →
Please review my code ,it is showing run time error an i am not able to solve it.
import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;
public class Solution {
public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); int q=0,f=0; double d=0,ans=0; outer: for(int i=1;i<=t;i++) { int s=0; for(int j=i;j>0;j=j/10) { f=j%10; f=f*f; s=s+f; } double r=Math.sqrt(s); q=(int)r; d=r-q; if(d==0) ans=ans+i; else continue outer; } System.out.println(ans); }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #171: Finding numbers for which the sum of the squares of the digits is a square
You are viewing a single comment's thread. Return to all comments →
Please review my code ,it is showing run time error an i am not able to solve it.
import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;
public class Solution {
}