Skip to content

Commit dd4af9d

Browse files
authored
Update amicable_pair(prob 21).java
1 parent b78e365 commit dd4af9d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Competitive Coding/Math/Project_Euler/amicable_pair(prob 21).java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
class p21
1+
class P21
22
{ //Begin class
33

44

55
/***** Function to calculate the sum of proper divisors or factors *****/
6-
static int sum_factors(int num)
7-
{ //Begin sum_factors()
6+
static int sumFactors(int num)
7+
{ //Begin sumFactors()
88
int sum = 0;
99

1010
for(int i = 1; i<num; i++)
@@ -14,21 +14,23 @@ static int sum_factors(int num)
1414
} //End for
1515

1616
return sum;
17-
} //End sum_factors()
17+
} //End sumFactors()
1818

1919

2020

2121

2222
public static void main(String args[])
2323
{ //Begin main()
24-
int sum_amicable = 0, x = 0, y = 0;
24+
int sum_amicable = 0;
25+
int x = 0;
26+
int y = 0;
2527

2628

2729
for(int n = 1; n<=10000; n++)
2830
{ //Begin for
2931

30-
x = sum_factors(n); //Sum of factors or divisors of n
31-
y = sum_factors(x); //Sum of factors or divisors of x
32+
x = sumFactors(n); //Sum of factors or divisors of n
33+
y = sumFactors(x); //Sum of factors or divisors of x
3234

3335

3436
/***

0 commit comments

Comments
 (0)