SHARE
TWEET

Untitled

a guest May 19th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package nl.erik.project1;
  2.  
  3. public class Opdracht4
  4. {
  5.    
  6.     int a, b, j, calc;
  7.     int[] valid_As, valid_Bs;
  8.  
  9.     public void main (int args)
  10.     {
  11.         while (b <= 1000)
  12.         {
  13.             while (a < b)
  14.             {
  15.                 calc = (a*a + b*b + 1)/(a*b);
  16.                 if (calc % Math.floor(calc) == 0)
  17.                 {
  18.                     valid_As[j] = a;
  19.                     valid_Bs[j] = b;
  20.                     j++;
  21.                 }
  22.                 a++;
  23.             }
  24.             b++;
  25.         }
  26.         for (int k = 0; k <= j; k++)
  27.         {
  28.             System.out.println("Combination " +k+ " is:   a: " +valid_As[k]+ "b: " +valid_Bs[k]+ ".");
  29.         }
  30.     }
  31. }
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top