Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. Two integers are considered to be relatively prime if there exists no integer greater than 1 that divides into them both. For example,
3. Two integers are considered to be relatively prime if there exists no integer greater than 1 that divides into them both. For example, the numbers 9 and 10 are relatively prime because there is no number (other than 1) that divides into them both (although the numbers themselves are non-prime). That is, the only numbers that divide into 9 are 3 and 9 (ignoring 1). Neither 3 nor 9 divide into 10. Write a program that obtains 2 integers from the user and determines whether they are relatively prime. Include in your program a function which determines the factors of an integer and puts the factors in an array - the prototype is: void getFactors (int number, int factors [])%;B You do not need to include the factor 1 in the array. Use a sentinel value in the array to indicate where the factors finish. (Hint: you can use the function above to get the factors of one of the numbers, then use the contents of the factors ( ) array to divide into the second number in order to test if there's a common factor.) (30 marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started