fork download
  1. class prime{
  2. int i,n,j;
  3. int [] prime = new int[100];
  4. void primejudge(){
  5. for(n = 2; n <= 100;n++){
  6. for(i = 2;i<n;i++){
  7. if(n % i == 0){
  8. break;
  9. }
  10. if(n - 1 == i){
  11. prime[j] = n;
  12. j++;
  13. }
  14. }
  15. }
  16. }
  17. int [] get(){
  18. return prime;
  19. }
  20. int getj(){
  21. return j;
  22. }
  23. }
  24. class SUM{
  25. int x,y,scores;
  26. int [] prime = new int[100];
  27. void SUM(int z){
  28. for(x = 0; x < z; x++){
  29. for(y = 0; y < z;y++){
  30. scores = prime[x]*prime[y];
  31. if(scores == 589){
  32. System.out.println("A*B=589になるABの値");
  33. System.out.println("A" +prime[x]);
  34. System.out.println("B" +prime[y]);
  35. }
  36. }
  37. }
  38. }
  39. }
  40. class abc{
  41. public static void main(String[] args){
  42. int j = 0;
  43. int [] prime;
  44. prime p = new prime();
  45. p.j =0;
  46. p.primejudge();
  47. prime = p.get();
  48. j = p.getj();
  49. SUM q = new SUM();
  50. q.prime = prime;
  51. q.SUM(j);
  52. }
  53. }
  54.  
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
A*B=589になるABの値
A19
B31
A*B=589になるABの値
A31
B19