Write a factorial program using C.
Answer / Andleeb Sayyed
Here is a simple recursive function that calculates the factorial of a given number n:
```c
long long factorial(int n) {n if (n == 0 || n == 1)
return 1;
else
return n * factorial(n - 1);
}n
```
| Is This Answer Correct ? | 0 Yes | 0 No |
Is array name a pointer?
to get a line of text and count the number of vowels in it
what type of language is C?
what is difference between c and c++
How can I implement opaque (abstract) data types in C? What's the difference between these two declarations? struct x1 { ... }; typedef struct { ... } x2;
How can I remove the leading spaces from a string?
Who is invented by c?
When should I declare a function?
What is the difference between declaring a variable by constant keyword and #define ing that variable?
what is event driven software and what is procedural driven software?
Here is a neat trick for checking whether two strings are equal
Difference between pass by reference and pass by value?