Page 1 of 1

20 points Question 2(a): Write down a function that will take an integer as parameter and will return 1 if the integer i

Posted: Sat Nov 27, 2021 10:29 am
by answerhappygod
20 Points Question 2 A Write Down A Function That Will Take An Integer As Parameter And Will Return 1 If The Integer I 1
20 Points Question 2 A Write Down A Function That Will Take An Integer As Parameter And Will Return 1 If The Integer I 1 (73.94 KiB) Viewed 63 times
20 points Question 2(a): Write down a function that will take an integer as parameter and will return 1 if the integer is a perfect number and return 0 otherwise. Using this function write down a program that will print all perfect numbers between two ranges n1 and n2. n1 is the last two digits of your student ID whereas n2 will be input to your program. Assume that n1 < n2. Recall that a perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding the number itself. For example, 6 is a perfect number because its positive divisors are 1, 2, 3 and the summation of these positive numbers are 1+2+3 = 6, which is the number itself. Sample Input/Output (For Student ID 20201001): Enter n2: 20000 6 28 496 8128