Computer Sciences > Gate 2019 > Recursion
Consider the following C program:
void convert(int n) {
if (n < 0)
printf(“ % d”, n);
else {
convert(n / 2);
printf(“ % d”, n % 2);
}
}
Which one of the following will happen when the function convert is called with any positive integer n as argument?if (n < 0)
printf(“ % d”, n);
else {
convert(n / 2);
printf(“ % d”, n % 2);
}
}
Correct : c
Similar Questions
Consider the following C function.
int fun (int n)
{
int x=1, k;
if (n==1) return x;
for (k=1; k < n; ++k)
&...
Consider the following C function.
int fun (int n)
{
int x=1, k;
if (n==1) return x;
for (k=1; k < n; ++k)
&...
Consider the following C function.
int fun (int n)
{
int x=1, k;
if (n==1) return x;
for (k=1; k < n; ++k)
&...
Total Unique Visitors
Loading......