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

How would you rename a function in C?

1 Answers   Tech Mahindra,


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?

2 Answers   Zensar,


What are the advantages of using linked list for tree construction?

1 Answers  


Program to find the absolute value of given integer using Conditional Operators

6 Answers   N Tech,


What are the types of functions in c?

1 Answers  


How can I find out how much free space is available on disk?

1 Answers  


what are the advantages of a macro over a function?

1 Answers   TCS,


How to write a C program to determine the smallest among three nos using conditional operator?

2 Answers   Google,


What is spark map function?

1 Answers  


What would be an example of a structure analogous to structure c?

1 Answers  


What is the output of the following program main();{printf ("chennai""superkings"}; a. Chennai b. superkings c. error d. Chennai superkings

6 Answers  


What is Heap?

3 Answers  


Categories