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



What is the output of the following progarm? #include<stdio.h> main( ) { int x..

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 the output of the following progarm? #include<stdio.h> main( ) { int x..

Answer / kalyan chukka

A.24

Is This Answer Correct ?    4 Yes 4 No

Post New Answer

More C Interview Questions

What is pragma in c?

0 Answers  


Explain the use of 'auto' keyword in c programming?

0 Answers  


What is the method to save data in stack data structure type?

0 Answers  


what is the difference between malloc() and calloc() function?

1 Answers  


Explain how do you print only part of a string?

0 Answers  






Is using exit() the same as using return?

0 Answers  


Why can’t we compare structures?

0 Answers  


#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?

0 Answers   TISL,


Write program to remove duplicate in an array?

0 Answers  


#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); }

0 Answers   Wilco,


What are the different types of endless loops?

0 Answers  


Categories