answersLogoWhite

0

Note: You may need a larger data type, factorials become very big very quickly and may cause an overflow long factorial(int x) { if(x == 1) return 1; . return((long) factorial(x-1) * x);

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

Does javascript support recursive functions?

Yes, but a recursive function running for a long time would eventually cause your program to crash.


Write a c program to find GCD of two given integers by using both recursive n non recursive functions?

i love u darling


Advantages of using C function?

* Debugging is easier * It is easier to understand the logic involved in the program * Testing is easier * Recursive call is possible * Irrelevant details in the user point of view are hidden in functions * Functions are helpful in generalizing the program


What is analysis of recursive program?

1) Recursive algorithms 2) Basic Principle 3) Analysis


Why recursive solution is better for tree traversal?

Because a tree is a recursive data-structure. It's easier to write (and easier to understand) a recursive program for handling it.


Jntu 2-2 oops through java answers?

write a java program to find factorial using recursive and non recursive


What happens when a recursive function never encounters a base case?

When a recursive function never encounters a base case, it leads to infinite recursion. This means the function keeps calling itself indefinitely, consuming memory and CPU resources. Eventually, this results in a stack overflow error, causing the program to crash or terminate unexpectedly. Properly designed recursive functions must always include a base case to prevent this situation.


What is the code of a c program that will read in a positive integer value and determine If the integer is a prime number and If the integer is a Fibonacci number?

see the program


Write a program to subtract integer y from integer x?

x -=y;


What is the name of Russian leader who followed Peter the Great and continued to implement his program?

Catherine followed Peter the Great and continued to implement his program.


Is -5 a integer?

1 hour ago my c program said no, but now I know 5 actually is an integer!


Write a program to implement prim's algorithm?

dfgbrgffee