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 would you rename a function in C?
write a function that accepts an array A with n elements and array B with n-1 elements. Find the missing one in array B,with an optimized manner?
What are the advantages of using linked list for tree construction?
Program to find the absolute value of given integer using Conditional Operators
What are the types of functions in c?
How can I find out how much free space is available on disk?
what are the advantages of a macro over a function?
How to write a C program to determine the smallest among three nos using conditional operator?
What is spark map function?
What would be an example of a structure analogous to structure c?
What is the output of the following program main();{printf ("chennai""superkings"}; a. Chennai b. superkings c. error d. Chennai superkings
What is Heap?