-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFactorGenerator.java
More file actions
46 lines (40 loc) · 1.33 KB
/
Copy pathFactorGenerator.java
File metadata and controls
46 lines (40 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package suduko;
public class FactorGenerator {
int number;
private int myRow;
private int myColumn;
public FactorGenerator(int number) {
this.number = number;
GenerateFactor();
}
// sirf do factor chahiye and factor1 and factor2 ko multiply karne par same number chahiye!!
private void GenerateFactor() {
for (int i = 1; i <= number; i++) {
for (int j = 1; j < +number; j++) {
if (number % i == 0 && i != 1 && i != number) {
if (number % j == 0 && j != 1 && j != number) {
if (i * i == number) {
myRow = i;
myColumn = i;
return;
} else if (i * j == number) {
myRow = i;
myColumn = j;
return;
}
}
}
}
}
}
public int ROWS() {
return myRow;
}
public int COLUMS() {
return myColumn;
}
}