SHARE
TWEET

Untitled

a guest Dec 2nd, 2014 13 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Tupel2
  2. {  
  3.     public static String tupelfinden(double maxgrenze)
  4.     {
  5.         double a;
  6.         double b;
  7.         double c;
  8.         double cSumme =0;
  9.         double bmin;
  10.         double bmax;
  11.         double aDifferenz;
  12.         String ergebnis ="";          
  13.        
  14.           bmax = Math.ceil(Math.cbrt(maxgrenze*maxgrenze));
  15.           for(b = 1; b <= bmax ;b++)
  16.              {
  17.                 a =1;
  18.                 do
  19.                  {                                
  20.                     cSumme = a*a*a +b*b*b;
  21.                     c = Math.sqrt(cSumme);
  22.                     a++;
  23.                                        
  24.                     if(c == (long)c && c*c <=maxgrenze*maxgrenze)
  25.                     {
  26.                      ergebnis = "\n\t( " + (a-1) + "," + b + "," + c + " )\n";            
  27.                      System.out.println("(" + (a-1) + ", " + b + ", " + c + ")");
  28.                    
  29.                     }
  30.                 }while(a<=b);          
  31.     }
  32.  return(ergebnis);
  33. }
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top