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
Answer Posted / 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 |
Post New Answer View All Answers
How can I do peek and poke in c?
Tell me about low level programming languages.
How will you find a duplicate number in a array without negating the nos ?
Explain how do you sort filenames in a directory?
What is the purpose of 'register' keyword?
How does free() know explain how much memory to release?
Write a program to reverse a given number in c language?
Explain what is the stack?
What does %d do?
How to explain the final year project as a fresher please answer with sample project
Explain how can you restore a redirected standard stream?
Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?
Can we access the array using a pointer in c language?
Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.
How are structure passing and returning implemented?