What is the output of the following progarm?



#include<stdio.h>

main( )

{

int x,y=10;

x=4;

y=fact(x);

printf(ā€œ%d\nā€,y);

}



unsigned int fact(int x)

{

return(x*fact(x-1));

}

A. 24

B. 10

C. 4

D. none

Answer Posted / venu

ans:D.
when x= 1, x-1 =0, so total value = 0;
in fact() they are not checking if x==1 && x==0.

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

is it possible to create your own header files?

648


What is a volatile keyword in c?

647


What are c identifiers?

635


What is malloc() function?

646


Explain what is a stream?

615






How can you increase the allowable number of simultaneously open files?

603


What language is windows 1.0 written?

583


Why isn't it being handled properly?

651


What are the two types of functions in c?

577


Why main is used in c?

596


Is there any demerits of using pointer?

636


Explain how can you determine the size of an allocated portion of memory?

631


which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above

1425


Tell me when would you use a pointer to a function?

615


What is volatile, register definition in C

697