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
Implement a command console for changing settings on a particular object. The command console should allow you to enter a string and will return the response (very similar to a terminal session). The commands are as follows: SET propertyname=newvalue will change the target object’s member named “propertyname” to have a value equal to “newvalue”. If the input value is incompatible (i.e. an int being set to a string), print out an appropriate error message. GET propertyname will print out the current value of the target object’s member named “propertyname”. GET * will print out a list of all target object members and their current values. The system should be extensible for future commands and should accept an arbitrary object, such that another developer could insert another object into the system and rely on the command console to get and set the properties correctly.
write a program using virtual function to find the transposing of a square matrix?
Code for Two Classes for Doing Gzip in Memory?
write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used
Question 1: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. *This Should Be Done IN C++
A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect
how to diplay a external image of output on winxp by using c & c++,
can you please write a program for deadlock that can detect deadlock and to prevent deadlock.
Code for Small C++ Class to Transform Any Static Control into a Hyperlink Control?
What output does the following code generate? Why? What output does it generate if you make A::Foo() a pure virtual function? class A { A() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; class B : public A { B() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; int main(int, char**) { A objectA; B objectB; return 0; }
how to write a program that opens a file and display in reverse order?
Code for Easily Using Hash Table?
U hv to enter a range from a and b and search hw many no. of times a pattern n. occurs between the range a and b. Eg :i/p:enter range :0 100 Enter pattern: 13 o/p: the no. times 13 occurred betwwn 0 to 100:1 Eg :i/p:enter range :100 1000 Enter pattern: 13 o/p: the no. times 13 occurred betwwn 100 to 1000: (in this 13,113,131,132,133…139,213,313,…913 all these will be counted)
how to take time as input in the format (12:02:13) from user so that controls remains between these columns?
1+1/2!+1/3!+...+1/n!