Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

Conduct an effective performance feedback session. page 376

Answered: 1 week ago