-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFunLoops.java
47 lines (40 loc) · 1020 Bytes
/
FunLoops.java
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
47
//Luke Bradaric
public class FunLoops
{
int sum;
int sumCount;
int sqCount;
int mgSqFound;
public FunLoops()
{
}
public void MagicSquare(int findThese){
while(sqCount <= findThese){
if(Math.sqrt(sqCount) == sum){
System.out.println(Math.sqrt(sqCount));
mgSqFound++;
sqCount++;
}
else if(sum < Math.sqrt(sqCount)){
sum+=sumCount;
sumCount++;
}
else{
sqCount++;
}
}
}
public void LCM(int one, int two){
int counter = 1;
boolean counting = true;
while(counting == true){
if(counter % one == 0 && counter % two == 0){
counting = false;
System.out.println(counter + " is the LCM");
}
else{
counter++;
}
}
}
}