find factoril in C using recursion
#include<stdio.h>
fact(int i, int k){
k=k*i;
i--;
if(i==0){
return k;
}
else{
fact(i, k);
}
}
int main()
{
int k = 1, i, factorial;
scanf("%d",&i);
factorial = fact(i, k);
printf("%d\n",factorial);
return 0;
}#include<stdio.h>
long int multiplyNumbers(int n);
int main() {
int n;
printf("Enter a positive integer: ");
scanf("%d",&n);
printf("Factorial of %d = %ld", n, multiplyNumbers(n));
return 0;
}
long int multiplyNumbers(int n) {
if (n>=1)
return n*multiplyNumbers(n-1);
else
return 1;
}
Also in C:
- find the largest number in else if javascript
- arduino keypad wait for key
- pow() c
- markdown empty line
- print long in c
- uint32_t extract first bits
- duplicar cadena
- check if string starts with c
- what is conio.h
- first person view unity
- lognormal distribution - matlab
- java.lang.SecurityException: Permission denied (missing INTERNET permission?)
- declare variable in c
- eeprom read arduinojson object
- read file in C
- if statement shorthand c
- check if audio is muted python
- how to add user to role postgresql
- C printf to string
- es palindromo
- download file by command line windows
- How to Convert double to int in C
- random en c
- find factoril in C using recursion