Question: Write a program that will take two positive integers as input. Let's call the inputs a and b. Your program should output the sum of
Write a program that will take two positive integers as input. Let's call the inputs a and b. Your program should output the sum of all the common factors of a and b that are NOT prime. Here is an input/output table with some examples: Input Output Explanation 28 and 14 15 Factors of 28 are 1, 2, 4, 7. 14, 28 Factors of 14 are 1, 2, 7, 14 The highlighted numbers are common factors among both 28 and 14. But, 2 and 7 are prime numbers so we exclude them. Adding up the rest, we get 1-14 = 15 27 and 36 10 Factors of 27 are 1. 3.9. 27 Factors of 36 are 1, 2.3,4,6,9, 12, 18, 36 The highlighted numbers are common factors among both 27 and 36. But, 3 is a prime number so we exclude it. Adding up the rest, we get 1+9 = 10 You may assume that all inputs will be positive Integers. You do not need to check. You must not use arrays to solve this problem. If you use arrays, you will receive a mark of o
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
