plz answer..... a program that reads non-negative integer
and computes and prints its factorial
Answer Posted / valli
//using recursion
fact(int);
main()
{
int n;
printf("enter n");
scanf("%d",n)
if(n<0)
printf("invalid number");
else
printf("factorial of %d =%d",n,fact(n));
}
fact(int n)
{
if(n==0||n==1)
return 1;
else
return n*fact(n-1);
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Why does this code crash?
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
Tell me can the size of an array be declared at runtime?
Explain why C language is procedural?
Which one would you prefer - a macro or a function?
What is the benefit of using const for declaring constants?
Why is c so powerful?
What is FIFO?
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
When should a type cast be used?
Why c is a mother language?
Describe static function with its usage?
How important is structure in life?
can any one tel me wt is the question pattern for NIC exam
Explain what are the standard predefined macros?