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 pragma in c?
Explain the use of 'auto' keyword in c programming?
What is the method to save data in stack data structure type?
what is the difference between malloc() and calloc() function?
Explain how do you print only part of a string?
Is using exit() the same as using return?
Why can’t we compare structures?
#include <stdio.h> #define sqr(x) (x*x) int main() { int x=2; printf("value of x=%d",sqr(x+1)); } What is the value of x?
16 Answers Accel Frontline, Opera, Oracle,
Are the variables argc and argv are local to main?
Write program to remove duplicate in an array?
#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }
What are the different types of endless loops?