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
Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).
A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect
Create a program to read two random data set in two files named data1.txt and data2.txt manifold contains integer numbers, whereas data2.txt file contains the float type numbers. Simpanlahmasing each into 2 pieces of data that is an array of type integer array and an array of type float, then calculate the average numbers in the second array.
can you please write a program for deadlock that can detect deadlock and to prevent deadlock.
output for printf("printf");
Definition of priority queue was given. We have to implement the priority queue using array of pointers with the priorities given in the range 1..n. The array could be accessed using the variable top. The list corresponding to the array elements contains the items having the priority as the array index. Adding an item would require changing the value of top if it has higher priority than top. Extracting an item would require deleting the first element from the corresponding queue. The following class was given: class PriorityQueue { int *Data[100]; int top; public: void put(int item, int priority); // inserts the item with the given priority. int get(int priority); // extract the element with the given priority. int count(); // returns the total elements in the priority queue. int isEmpty(); // check whether the priority queue is empty or not. }; We had to implement all these class functions.
Write a simple encryption program using string function which apply the substitution method.
Code for Method of Handling Factorials of Any Size?
how to write a program that opens a file and display in reverse order?
Code for Two Classes for Doing Gzip in Memory?
write a program that can LOCATE and INSERT elements in array using c++ programming languages.
write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used
What output does this program generate as shown? Why? class A { A() { cout << "A::A()" << endl; } ~A() { cout << "A::~A()" << endl; throw "A::exception"; } }; class B { B() { cout << "B::B()" << endl; throw "B::exception"; } ~B() { cout << "B::~B()"; } }; int main(int, char**) { try { cout << "Entering try...catch block" << endl; A objectA; B objectB; cout << "Exiting try...catch block" << endl; } catch (char* ex) { cout << ex << endl; } return 0; }
write a program to convert temperature from fa height into celcius and vise versa,use modular programming
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