fun(int x)
{
if(x > 0)
fun(x/2);
printf("%d", x);
}
above function is called as:
fun(10);
what will it print?
}
Answer Posted / ashwin kumar
hi Gg
answer is 0 1 2 5 10
this not stack prlm dear
here printf is after the function call dear so it is
printing 0 1 2 5 10
if u wnt to see 10 5 2 1 0 as output plz keep printf
function before function call that is
fun(int x)
{
if(x > 0)
printf("%d\n", x);
fun(x/2);
}
but output will be 10 5 2 1 only on 0 is printed
this above new code will give segmentation error in netbeans
thank u dear
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the right type to use for boolean values in c? Is there a standard type?
How can I find the modification date and time of a file?
What is the main difference between calloc () and malloc ()?
What is a program flowchart?
What does void main return?
When we use void main and int main?
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
What is volatile variable in c?
What is New modifiers?
Using which language Test cases are added in .ptu file of RTRT unit testing???
What is the use of function in c?
What is the total generic pointer type?
Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record
What is the advantage of a random access file?
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.