question archive This question requires you to design two functions
Subject:Computer SciencePrice: Bought3
This question requires you to design two functions. 279 280 The first function, factors(), returns the sum of all proper divisors or 281 factors of n. Proper factors of n are all numbers that divides n, excluding n. 282 As an example, the proper factors of 9 are: 1 and 3, thus factors(9) should 283 return 4 (1+3). Similarly factors(12) should return 16 (1+2+3+4+6). 284 285 Two numbers a and b are considered to be friends if factors(a) == b and 286 factors(b) == a. As an example, 220 and 284 are friends. Why? 287 Because factors(220) = 284 (1+2+4+5+10+11+20+22+44+55+110) and 288 factors(284) = 220 (1+2+4+71+142). 289 290 We call all the set of all such numbers: friendly numbers. 291 292 The second function, extraCredit(), finds the sum of all friendly numbers 293 between 1 and int(MY_NUM/10) 294 295 So if Jane is working on this extra credit problem, she should first 296 design the factors() function and then design extraCredit() such that 297 it uses factors() and finds out the sum of all friendly numbers between 298 1 and 1234 (int(12345/10) = 1234 ) 299 300 301 K / 302 303 int factors (int n) { 304 return 0; 305 } 306 int extraCredit( ) { 307 return 0; 308 309