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 |
What is a pointer in c plus plus?
What does main () mean in c?
What are the different categories of functions in c?
What are header files and explain what are its uses in c programming?
Explain how can I manipulate strings of multibyte characters?
Here is a neat trick for checking whether two strings are equal
How many keywords (reserve words) are in c?
main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); }
why we use "include" word before calling the header file. is there any special name for that include??????
write a program to print the one dimensional array.
#define d 10+10 main() { printf("%d",d*d); }
write a program to print sum of each row of a 2D array.