suma de n numeros recursiva
/*Construir una función recursiva que calcule la suma de los n primeros números
naturales.
*/
int suma(int n){
int res = 0;
if(n == 0){//Caso base
res = 0;
}else{
res = n + suma(n - 1);
}
return res;
}
Also in C:
- optimal page replacement algorithm to find page fault
- blockchain implementation in c
- c++ image processing
- how to use a pointer as a parameter in c
- typedef vs #define
- strcmp c
- casting an int to a char in c
- how to get random numbers in c
- how to make infinite loop in c
- convert string to lowercase in c
- lelcetric fied
- how to input a string into a char array cpp
- coin row problem in linear time
- sleep function in c
- Browse C s
- C largest unsigned int
- how to write flash memory in stm32f030
- how to get a lonng in scanf in c
- c producer consumer pthread semaphore
- c if else
- lazer codechef
- clear local changes in git
- if statement shorthand c
- save numpy array to text file