Here's the programm code:

int magic(int a, int b) {
return b == 0 ? a : magic(b, a % b);
}
int main() {
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", magic(a, b));
return 0;
}

on input stream we have integers 4, 45
What's the output integer?
How many times will be initiated "magic" function?

Answer Posted / shams

2 times and answer is 45...

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.

1961


Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).

3184


how to write a program that opens a file and display in reverse order?

2559


write a function that allocates memory for a single data type passed as a parameter.the function uses the new operator and return a pointer to the allocated memory.the function must catch and handle any exception during allocation

2390


write a program that can LOCATE and INSERT elements in array using c++ programming languages.

3424






Write a (n) algorithm that sorts n distinct integers, ranging in size between 1 and kn inclusive, where k is a constant positive integer. (Hint: Use a kn-element array.)

4437


write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used

4298


3. Program to find the Sum of give series. a. (1)+(1+2)+(1+2+3)+(1+2+3+4)+……………………………….. b. 1/1+1/9+1/25+1/49+……………...

4343


write a program that reverses the input number of n.Formulate an equation to come up with the answer.

7020


Write a C/C++ program that connects to a MySQL server and displays the global TIMEZONE.

4568


Code for Method of Handling Factorials of Any Size?

1996


Performance Algorithm A performs 10n2 basic operations and algorithm B performs 300 lg n basic operations. For what value of n does algorithm B start to show its better performance?

7326


Ask the user to input three positive integers M, N and q. Make the 2 dimensional array of integers with size MxN, where all the elements of I (I = 1,…,M) line will be members of geometrical progression with first element equal to the number of line (I) and denominator q.

3387


write a program to perform generic sort in arrays?

2614


Code for Easily Using Hash Table?

2383