#Write a function sumDivisor that has one parameter positive integer. The #function finds and prints the sum of all divisors of the parameter #Write a program that reads a sequence of positive #integers. First negative or zero terminates the input. For each number, #program uses function sumDivisor to find the sum of the divisors #Discussion: function sumDivisor. Example: parameter 15, function returns #1+3+5+15 #1 is a divisor of 15: 15%1 equals 0 #3 is a divisor of 15: 15%3 equals 0 #5 is a divisor of 15: 15%5 equals 0 #15 is a divisor of 15: 15%15 equals 0 #d is a divisor of num, if num%d equals 0 #In main: sentinel-controlled repetition def sumDivisor(num): sum=0 counter=1 #0 is not a valid divisor while(counter<=num): if(num%counter==0): sum=sum+counter counter=counter+1 return sum def main(): num=int(input("enter positive number ")) while(num>0): print(sumDivisor(num)) num=int(input("enter positive number ")) main() #While input is positive the loop continue to execute #NO COUNTER to control loop execution #Tracing: num = 6 #counter=1 1<=6 True 6%1==0 True, sum=0+1=1, counter=2 #counter=2 2<=6 True 6%2==0 True, sum=1+2=3, counter=3 #counter=3 3<=6 True 6%3==0 True, sum=3+3=6, counter=4 #counter=4 4<=6 True 6%4==0 False, counter=5 #counter=5 5<=6 True 6%5==0 False, counter=6 #counter=6 6<=6 True 6%6==0 True, sum=6+6=12, counter=7 #counter=7 7<=6 False loop is terminated