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
Answers were Sorted based on User's Feedback
Answer / 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 |
How can I remove the leading spaces from a string?
What are external variables in c?
why TCS selected more student in the software field from all institution.
how to find out the union of two character arrays?
what is the output of below code int x=8,y; x>>=2; y=x; what is y value. NOTE:EXPLANATION IS COMPALSARY with binary bits
How can you tell whether a program was compiled using c versus c++?
which header file contains main() function in c?
17 Answers Google, HCL, TCS,
What is a null pointer in c?
What is zero based addressing?
what is c language?
what r callback function?
how to multiply two number taking input as a string (considering sum and carry )