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 static and volatile in c?
Difference between null pointer and dangling pointer?
How many levels of pointers have?
main() { int i = 10; printf(" %d %d %d \n", ++i, i++, ++i); }
Why is c called a structured programming language?
What is getch() function?
What is self-referential structure in c programming?
How does variable declaration affect memory?
main() { struct test { char c; int i; char m; } t1; printf("%d %d\n", sizeof(t1), sizeof(t1.c)); }
1 Answers Vector, Vector India,
Write down the program to sort the array.
Write a program to find whether the given number is prime or not?
Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me