adspace
Answer Posted / 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 |
Post New Answer View All Answers
What is the difference between union and anonymous union?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
In C programming, how do you insert quote characters (‘ and “) into the output screen?
write a program to find out prime number using sieve case?
develop algorithms to add polynomials (i) in one variable
Is int a keyword in c?
Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.
What are compound statements?
ATM machine and railway reservation class/object diagram
Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?
What are pointers? What are different types of pointers?
write a progrmm in c language take user interface generate table using for loop?
write a c program to find the sum of five entered numbers using an array named number
what is ur strangth & weekness
What is the general form of a C program?