Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please use pointer and function in C language , Thank you! In mathematics, a divisor of an integer n, also called a factor of n,
Please use pointer and function in C language, Thank you!
In mathematics, a divisor of an integer n, also called a factor of n, is an integer m that may be multiplied by some integer to produce n. In this case, one also says that n is a multiple of m. An integer n is divisible by another integer m if m is a divisor of n; this implies dividing n by m leaves no remainder. Now assume m and p are two divisors of n such that n = m xp, and let us call these two numbers "pair divisors" of n. Write a C program that receives an input number n and a query number q and checks if there is any "pair divisors" of n that their sum is equal to the query number (checks whether q == p +m). If there is any pair divisors, your code should return one of those pairs. Notes: Must write a function that computes the pair divisors of n and returns one that their sum equals q (if there is any). This function is called by the "main" function and sets the pair values it finds via pointer addresses. Use the form of this prototype: void getPairDivisor(int n, int q, int* mAddress, int* pAddress) The variables mAddress and pAddress are the addresses to values of found p and m. Your code should handle the cases where it does not find any result. Your programs should work for any positive integer values of n, q (i.e. both n >= 1 and qStep 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