write a program that finds the factorial of a number using
recursion?
Answer Posted / abhinandan
#include<stdio.h>
main()
{
int a, fact;
printf("\nEnter any number: ");
scanf ("%d", &a);
fact=rec (a);
printf("\nFactorial Value = %d", fact);
}
rec (int x)
{
int f;
if (x==1)
return (1);
else
f=x*rec(x-1);
return (f);
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What is the scope of static variable in c?
formula to convert 2500mmh2o into m3/hr
Calculate 1*2*3*____*n using recursive function??
In a switch statement, explain what will happen if a break statement is omitted?
What is a dynamic array in c?
What is derived datatype in c?
What is data structure in c language?
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
Explain what standard functions are available to manipulate strings?
Why can’t constant values be used to define an array’s initial size?
Explain why c is faster than c++?
a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.
Explain the use of keyword 'register' with respect to variables.
What is include directive in c?
disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit