File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Competitive Coding/Math/Project_Euler Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 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 ()
88int sum = 0 ;
99
1010for (int i = 1 ; i <num ; i ++)
@@ -14,21 +14,23 @@ static int sum_factors(int num)
1414} //End for
1515
1616return sum ;
17- } //End sum_factors ()
17+ } //End sumFactors ()
1818
1919
2020
2121
2222public 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
2729for (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/***
You can’t perform that action at this time.
0 commit comments